-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Clarify portals docs #840
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
Comments
(Moved from #911) — I think we should also include a mention of whether the Portal will take control of the DOM element it receives as Another thing I was momentarily surprised by — although it makes perfect sense — is that if you rely on CSS classes to style an element that you then transport to a different part of the the DOM, it will not inherit styles from its parent React element. Maybe warrants a tiny note? |
@gaearon can we close this? I think you explained this well in the new docs https://react.dev/reference/react-dom/createPortal |
https://reactjs.org/docs/portals.html
We should make it clearer in the first paragraph it’s not imperative and doesn’t “work” outside of render. There is a common confusion that this should be called in lifecycles (where it has no effect).
The text was updated successfully, but these errors were encountered: