-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Improve validateDOMNesting message for whitespace #7515
Conversation
} else { | ||
tagDisplayName = 'Whitespace text nodes'; | ||
whitespaceInfo = | ||
' Make sure you don\'t have any extra whitespace between tags on ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this message be confusing? Whitespace doesn't matter between JSX tags -- doesn't this problem only occur when there's whitespace inside a variable?
Edit: Nevermind, per this blog post, whitespace can appear when:
Element nodes will maintain white space when mixed with with non-element nodes on the same physical line of JSX code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace between tags on a single line matters, and I believe that's the most common cause of extra whitespace. See "Foo" in the test case below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, didn't know that. I guess that makes sense, but it's not something you normally think about! (Which is why this warning is helpful!)
👍 |
For #5071.