Possible to use MaterialUI Table with the renderer prop? #617
-
For some reason, the thead, tbody, tr, td, and th elements arent rendered properly. code works fine, table works fine, but for some reason, these don't. Currently, I have: const renderers = {
td: ({ children }) => (<TableCell>{children}</TableCell>),
tr: ({ children }) => (<TableRow>{children}</TableRow>),
th: ({ children }) => (<TableCell>{children}</TableCell>),
thead: ({ children }) => (<TableHead>{children}</TableHead>),
tbody: ({ children }) => (<TableBody>{children}</TableBody>),
table: ({ children }) => (
<TableContainer component={Paper}>
<Table>{children}</Table>
</TableContainer>
),
}; I end up getting: <table class="MuiTable-root">
<thead>
<tr>
<th>Hello</th>
<th>World</th>
</tr>
</thead>
</table> Is there anything I've done wrong in the renderer prop? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
it is and it is documented how in the readme
https://github.com/remarkjs/react-markdown#props the node types that can be mapped are documented here: https://github.com/remarkjs/react-markdown#appendix-b-node-types
match the in your example |
Beta Was this translation helpful? Give feedback.
it is and it is documented how in the readme
https://github.com/remarkjs/react-markdown#props
the node types that can be mapped are documented here: https://github.com/remarkjs/react-markdown#appendix-b-node-types
and include:
match the
renderer
prop name with the node name you want, and the custom render function will work.in your example
table
works because it matches the node type you want to map.thead
should betableHead
to work,tbody
…