Closed
Description
I know that there is still much consideration going into #890 so I don't mean to rush, but I thought you might be interested to know:
It looks like React 16.3 exposes the new lifecycles in a way that disallow for using the old componentWill* at the same time as new lifecycles.
Something that looks roughly like this:
class Form extends PureComponent {
constructor(props) {
super(props);
this.state = {initialized: false};
}
static getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.data && !prevState.initialized) {
return {initialized: true};
}
return null;
}
render() {
return this.state.initialized ? "initialized" : "uninitialized"
}
}
export default connect()(Form);
will get this warning:
which I didn't understand until I saw that the implementation details of connect
use inheritance to add those lifecycles.
My workaround in this first case I found in my code is pretty easy to fix (I was just using the connect
to get a dispatch method) but I bet people are going to start running into this as they upgrade to 16.3.
Sending my best to your efforts in #890 !
Metadata
Metadata
Assignees
Labels
No labels