-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
createPortal child ref callbacks are called AFTER componentDidMount #11621
Labels
Comments
ajhyndman
changed the title
React 16 createPortal
createPortal child ref callbacks are called AFTER componentDidMount
Nov 22, 2017
Ahh, this one is user error. I had a typo in my reduced test case, and I was misunderstanding the composition in the scenario I thought I ran into this at first.
|
This was referenced Mar 15, 2021
This was referenced Nov 5, 2022
This was referenced Dec 25, 2022
This was referenced Nov 27, 2023
This was referenced May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using the new ReactDOM
createPortal
API, adding a ref callback to the portal subtree is not fired until aftercomponentDidMount
in the current component.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template for React 16: https://jsfiddle.net/Luktwrdm/, template for React 15: https://jsfiddle.net/hmbg7e9w/).
https://codesandbox.io/s/lykxzopwj9
What is the expected behavior?
I expected ref callbacks in children rendered into a portal (like other children) to have been fired before the parent component's
componentDidMount
lifecycle method.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
I have tested versions of React from
16.0.0
to current (16.1.1
), and they seem to share the same behaviour.The text was updated successfully, but these errors were encountered: