-
Notifications
You must be signed in to change notification settings - Fork 50.8k
Closed
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
In a component loaded using React.lazy, default props are not merged into the props object for these lifecycles:
- componentDidMount
- componentDidUpdate
- componentWillUnmount
- getSnapshotBeforeUpdate
In shouldComponentUpdate, default props are merged into the nextProps argument, but not this.props.
Steps to reproduce:
- Create a component that has a default value for a prop using defaultProps.
- Use that prop in one of the above lifecycles.
- Load the component using React.lazy.
- Observe that the prop is not defined in the above lifecycles.
What is the expected behavior?
Default props should be merged into props for all lifecycles when using React.lazy.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
react 16.6.0
react-dom 16.6.0
Windows 10 Firefox 63.0
Windows 10 Chrome 70.0.3538.77
React.lazy was not in previous versions of React
Reactions are currently unavailable