Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Unsafe lifecycle methods with the StrictMode #685

Open
eggcllnt opened this issue Jun 5, 2018 · 1 comment
Open

Unsafe lifecycle methods with the StrictMode #685

eggcllnt opened this issue Jun 5, 2018 · 1 comment

Comments

@eggcllnt
Copy link

eggcllnt commented Jun 5, 2018

Hi!

I have an error when using HOC's wrapped in a new StrictMode component which tells me I have Unsafe lifecycle methods and it says it's componentWillReceiveProps.
So, this is just a warning about deprecated (unsafe) new lifecycle methods from React 16.3 version.

I guess this warning caused by withStateHandlers HOC in my case, but a lot of HOC's which used as observable stream also use componentWillReceiveProps method.

@mpyw
Copy link

mpyw commented Jun 13, 2018

+1 👍

Currently I'm ignoring the warnings in my React Native (v0.54) project.

import { YellowBox } from 'react-native'

YellowBox.ignoreWarnings([
  'Warning: componentWill',
])

componentWillReceiveProps should be replaced into static getDerivedStateFromProps

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants