Skip to content
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

Clarify createPortal usage #845

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

raunofreiberg
Copy link
Contributor

#840. I think this clarification makes more sense as a note.

@raunofreiberg raunofreiberg changed the title Clarify that createPortal should be used in the parent component's re… Clarify createPortal usage Apr 26, 2018
@reactjs-bot
Copy link

reactjs-bot commented Apr 26, 2018

Deploy preview for reactjs ready!

Built with commit 2c07ff9

https://deploy-preview-845--reactjs.netlify.com

@gaearon
Copy link
Member

gaearon commented Apr 26, 2018

I don't think this is technically accurate. You could call it in a lifecycle, then put the result into state and then use that in render. Not necessarily useful but possible.

The important part is that it doesn't do anything imperatively and it just produces an object similar to a React element. The portal only "works" when this object is included in the rendered tree.

@raunofreiberg
Copy link
Contributor Author

raunofreiberg commented Apr 27, 2018

What about something like this? I don't really like the word "work/working" since it's quite ambiguous and tried to avoid it.

BetterZxx pushed a commit to BetterZxx/react.dev that referenced this pull request Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants