Description
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 after componentDidMount
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.