-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whitespace text nodes cannot appear as a child of <tr> #2000
Labels
💪 phase/solved
Post is done
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Does anyone have a workaround? |
There’s a workaround mention in the post:
Even better, use an expression: export const planet = 'World'
# Hello, {planet}!
{
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
</table>
} |
wooorm
added a commit
that referenced
this issue
Feb 9, 2023
Whitespace should be fine but React still fails on it. Closes GH-2000.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial checklist
Affected packages and versions
[email protected]
Link to runnable example
Code Sandbox
Steps to reproduce
Seems we are unable to render jsx tables without white space warnings. This is not limited to
<tr>
as the title suggests, but pretty much any scenario where'd you want to write a table in jsx directly using typical code indentation will result in this error: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.
.code sandbox repro: https://codesandbox.io/s/fervent-star-m9qufk?file=/src/App.js
Easy work around is to wrap the jsx in a component: https://codesandbox.io/s/wonderful-haibt-bldeqz?file=/src/App.js
So not really a huge problem, but something I thought was worth bringing up.
Expected behavior
Semantic tables in jsx/html (non-markdown) don't result in console warnings.
Actual behavior
jsx/html (non-markdown) tables result in validateDOMNesting warnings.
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: