`Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <table>`

See original GitHub issue

Subject 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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EvHauscommented, Oct 22, 2021

Confirmed this is fixed for me now after upgrading to the latest dependencies.

0reactions
wooormcommented, Oct 21, 2021

fixed!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found