-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Question: ReactDOM render call in useEffect delayed until first update #14792
Comments
Tested with Example: https://codesandbox.io/s/l4k2z31om |
Looks buggy to me. |
Thanks for looking into this and fixing it! |
Canary |
Fixed in 16.8.2. |
Is this still an issue in |
Do you want to request a feature or report a bug?
A question, maybe a bug but more likely a misunderstanding on my side.
What is the current behavior?
Calling
ReactDOM.render
from within auseEffect
won't actually render to the dom unless an update is triggered from anywhere else within the entire react app.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
See: https://codesandbox.io/s/jl02nrqznw
What is the expected behavior?
After the
RendersAnotherRoot
component is initially rendered, theuseEffect
function is called and then the subsequentReactDOM.render
call renders the separate react root.Note: Uncommenting the setCount update from within the
RendersAnotherRootWithUpdate
component will then render the content from bothuseEffect
render calls.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
react 16.8.1
react-dom 16.8.1
The text was updated successfully, but these errors were encountered: