-
Notifications
You must be signed in to change notification settings - Fork 45.7k
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
Deprecate return value of ReactDOM.render()
#6397
Comments
Related: #2642 (comment) |
ReactTestUtils might be an exception as a convenience. Testing likely needs its own reconciler anyway. |
After update react and react-dom from 15.0.0-rc.2 to 15.0.0 ReactDOM does not contain method render. ReactDOM.render is deprecated?
|
@ibhub I don't understand your question/comment. React v15.0.0 does contain a render function, and |
Ok, thanks. Perhaps bug in my code, but I don't understand why ReactDOM.render is undefined (only in 15.0.x version). if I find the reason I will comment. Upd: I found problem. I had incorrect alias to react-dom in webpack config. Sorry. |
I am using a library which requires HTML and does not accept a react component. The documentation explicitly says to use the return value of I suppose I could create a promise, return the future value of the promise and then add a callback and complete the promise in the callback. Would that work? Or would that just create the possibility of a deadlock? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
This is a tracking issue, because we're not ready to deprecate the return value of
ReactDOM.render()
yet. This will likely be a longer-term objective (not immediate), but we should have an issue to reference as we start to get the ball rolling.Reasoning: We are working towards a new incremental reconciler, which means that a render may not be complete prior to
ReactDOM.render()
returning. For anyone relying on the return value ofReactDOM.render()
, there would be a race condition where the returned instance is potentially not fully mounted. Safe-looking code might work 99% of the time, but fail 1% of the time, at the sole discretion of the scheduler. To be clear: this is not an issue today, but will become an issue once we start utilizing an incremental renderer, iff people rely on the return value.As we prepare for the new reconciliation algorithm, we should start encouraging people should start avoiding the return value of
ReactDOM.render
. People should, instead, attach a callback ref to their root component when rendering the component, thus allowing them to get a reference to the instance after mounting is complete.First step in this process is to update the documentation to state that the return value of
ReactDOM.render
is legacy, and that people should attach a ref instead (similar to what we did for string refs).The text was updated successfully, but these errors were encountered: