React-router: Use new getDerivedStateFromProps lifecycle method in React 16.3

Created on 9 Feb 2018  路  3Comments  路  Source: ReactTraining/react-router

As of react 16.3, componentWillReceiveProps has been marked as unsafe and should be replaced by getDerivedStateFromProps. RFC can be found here.

Most helpful comment

The deprecation warnings have not, though. Things aren't in place for us to test against yet. And we're not testing this library against alpha versions.

All 3 comments

We're aware of it, but some of this stuff is still being worked out. Those functions will not be changed in 16.3 from what I understand, but I may be out of date from my last meeting with the React team. Until there is actually a change in place to test against (16.3.0-alpha.0 doesn't have this), this is premature.

getDerivedStateFromProps has already landed and it is available on 16.3.0-alpha.0. It seems that they will only remove deprecated lifecycle methods on v17 but will start warning about deprecation on v16.4.

The deprecation warnings have not, though. Things aren't in place for us to test against yet. And we're not testing this library against alpha versions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stnwk picture stnwk  路  3Comments

maier-stefan picture maier-stefan  路  3Comments

jzimmek picture jzimmek  路  3Comments

ArthurRougier picture ArthurRougier  路  3Comments

tomatau picture tomatau  路  3Comments