Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. #82

Closed
IamFonky opened this issue Sep 17, 2019 · 5 comments

Comments

@IamFonky
Copy link

Hello!
My browser keeps yelling this warning.

´´´
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks 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: ReflexElement
´´´

Can I help you update this or are you already working on it?

@leefsmp
Copy link
Owner

leefsmp commented Sep 17, 2019

Yeah, haven't got time to migrate so far... All I did is a place older.

Feel free to contribute if you want to implement getDerivedStateFromProps.

Thanks

@IamFonky
Copy link
Author

Okidoki,
I'll try to do that!

@IamFonky
Copy link
Author

I forked and did some changes but, I really don't know how to use your Demo 😋
How to start a server after running npm run build-demo-dev ? (sry for my noobish questions)

@leefsmp
Copy link
Owner

leefsmp commented Sep 17, 2019

just open index.html in the browser, no need a server but you could use any local http server of your choice if you prefer.

@leefsmp
Copy link
Owner

leefsmp commented Sep 26, 2019

Closing that for now as using UNSAFE_componentWillReceiveProps should suppress the warning. Migrating ReflexContainer to use getDerivedStateFromProps is a lot of internal changes so postponing it until it becomes a real problem. ReflexElement has now been migrated in v 3.0.18.

@leefsmp leefsmp closed this as completed Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants