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
Re-render element in componentDidMount at once Error:Cannot read property 'rootID' of null. #6737
Comments
Can you reproduce your issue in a jsfiddle? https://jsfiddle.net/L3zn8dws/ |
The real question is why are you calling You should use a root parent component to manage which component renders, instead of trying to re-mount at the root. If you absolutely have to have multiple React roots (which you should have a really good reason for) you should be using some sort of helper system manage this: https://facebook.github.io/react/blog/2015/10/01/react-render-and-top-level-api.html#helpers
Rather than calling ReactDOM.render() directly everywhere, consider writing/using a library that will manage mounting and unmounting within your application. |
This seems like an unsupported pattern: you are trying to render something into a container that already contains another component whose lifecycles are currently being executed. If you want |
I do ReactDOM.render #container element(top-level) in componentDidMount function, React show me some error, Cannot read property 'rootID' of null.
If I use setTimeout run ReactDOM.render, it's work. (Even after 0ms)
I feel uncertain, could someone help me?
html:
A.jsx & B.jsx :
app.jsx:
The text was updated successfully, but these errors were encountered: