Skip to content

validateDOMNesting generates warnings for components that return null inside tbody #5506

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
gotbadger opened this issue Nov 19, 2015 · 2 comments

Comments

@gotbadger
Copy link

According to the doc on Render its ok for components to return null if nothing needs to be
rendered but this causes a warning from validateDOMNesting if used inside a tbody

var Component = React.createClass({
    render: function() {
      return null
    }
});
var Table = React.createClass({
    render: function() {
        return <table><tbody><Component /></tbody></table>;
    }
});

ReactDOM.render(
    <Table />,
    document.getElementById('container')
);

gives us the following warning:

Warning: validateDOMNesting(...): <noscript> cannot appear as a child of <tbody>. See Table > tbody > noscript.
@nabilfreeman
Copy link

well spotted 👍

@zpao
Copy link
Member

zpao commented Nov 19, 2015

It looks like we're going to make null actually render to comment nodes in #5451 so this should become a non-issue in the future.

@zpao zpao closed this as completed Nov 19, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants