`Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <table>`
See original GitHub issueSubject of the issue
When rendering:
<ReactMarkdown
plugins={[gfm]}
>
{`| table | md |
| --- | --- |
| row1 | more |
| row2 | text |`}
</ReactMarkdown>
with React v17.0.2, React Markdown v6.0.0, Remark Parse 9.0.0, Remark Rehype 8.1.0, Remark GFM 1.0.0, Firefox 87.0 will display warnings in the web developer console.
Your environment
- OS: Fedora 33, KDE Spin
- Packages: React 17.0.2, React Markdown 6.0.0, Remark Parse 9.0.0, Remark Rehype 8.1.0, Remark GFM 1.0.0
- Env: NodeJS 15.11.0, NPM 7.6.0, Firefox 87.0
Steps to reproduce
Minimal reproduction: https://codesandbox.io/s/react-markdown-debug-forked-otbbg
Expected behavior
Table should render without React warnings.
Actual behavior
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <table>. Make sure you don't have any extra whitespace between tags on each line of your source code.
table
div
ReactMarkdown@http://localhost:3000/app/static/js/vendors~main.chunk.js:154250:42
[...]
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <thead>. Make sure you don't have any extra whitespace between tags on each line of your source code.
thead
table
div
ReactMarkdown@http://localhost:3000/app/static/js/vendors~main.chunk.js:154250:42
[...]
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <tr>. Make sure you don't have any extra whitespace between tags on each line of your source code.
tr
thead
table
div
ReactMarkdown@http://localhost:3000/app/static/js/vendors~main.chunk.js:154250:42
[...]
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <tbody>. Make sure you don't have any extra whitespace between tags on each line of your source code.
tbody
table
div
ReactMarkdown@http://localhost:3000/app/static/js/vendors~main.chunk.js:154250:42
[...]
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
validateDOMNesting: #text cannot appear as a child of <tr ...
Whitespace text nodes cannot appear as a child of <tbody> . ... I removed that from between my table elements and the warning...
Read more >Whitespace text nodes cannot appear as a child of <table> #79
When I want to create a React table from a multi line string I will get a warning from React: index.js:1452 Warning: validateDOMNesting(....
Read more >Whitespace text nodes cannot appear as a child of <tbody ...
Error 2. Whitespace text nodes cannot appear as a child of <tbody>. Make sure you don't have any extra whitespace between tags on...
Read more >React DOM elements should be nested properly - DeepScan
React Warning: validateDOMNesting(…): Whitespace text nodes cannot appear as a child of <tr>. Make sure you don't have any extra whitespace ...
Read more >23 - Warning: validateDOMNesting(...):cannot appear as a child
Warning : validateDOMNesting (...): cannot appear as a child , Concept Fragments in React .Watch Full Part of this Series ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirmed this is fixed for me now after upgrading to the latest dependencies.
fixed!