Google-maps-react: Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code.

Created on 16 Sep 2020  路  3Comments  路  Source: fullstackreact/google-maps-react

I am currently using react 16.13.1 and google-maps-react 2.0.6. I am getting this warning on using Map and GoogleApiWrapper. "Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. 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

Please update the following components: Wrapper"

Most helpful comment

Why not update it to componentDidUpdate or either of the other two options provided in the React documentation? After React 16 this function will no longer work.

https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops

All 3 comments

I know it is not good idea but it works.
just remove <React.StrictMode> from index.js

Why not update it to componentDidUpdate or either of the other two options provided in the React documentation? After React 16 this function will no longer work.

https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops

anyone knows if there is already an active PR for this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vijayan-Murugan picture Vijayan-Murugan  路  4Comments

kevinSuttle picture kevinSuttle  路  4Comments

carmen79 picture carmen79  路  4Comments

lishi500 picture lishi500  路  4Comments

ktosiek picture ktosiek  路  3Comments