Graphiql: Remove use of componentWillReceiveProps for React 16

Created on 2 Oct 2019  路  2Comments  路  Source: graphql/graphiql

Hi 馃槉

Since the React 16.9.0 version, the following deprecation warning about React legacy lifecycle methods appears:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: GraphiQL, QueryHistory

Most helpful comment

Thanks @Gautierrr, however our peer resolutions are set to support react 15 currently, so this is out of our official support matrix currently. We are upgrading to React 16 in the coming weeks.

All 2 comments

Thanks @Gautierrr, however our peer resolutions are set to support react 15 currently, so this is out of our official support matrix currently. We are upgrading to React 16 in the coming weeks.

984 proposes deprecating React 15 peer support, which would allow us to use hooks, etc new features in our current implementation. A bit above and beyond the scope of this which is just to address the warnings, however I think with 2 years out from the last react 15.x.y release we are good for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

intellix picture intellix  路  10Comments

divyenduz picture divyenduz  路  16Comments

majkrzak picture majkrzak  路  12Comments

okorz001 picture okorz001  路  18Comments

dontsave picture dontsave  路  19Comments