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

componentWillReceiveProps has been renamed #1435

Closed
MalpenZibo opened this issue Apr 10, 2020 · 2 comments · Fixed by #1445
Closed

componentWillReceiveProps has been renamed #1435

MalpenZibo opened this issue Apr 10, 2020 · 2 comments · Fixed by #1445
Assignees
Labels

Comments

@MalpenZibo
Copy link
Member

Description

I get a Warning: componentWillReceiveProps has been renamed ..... Please update the following components: Select.

Maybe is related to this issue? JedWatson/react-select#3720

Log

react-dom.development.js?61bb:88 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: Select
@marcopiii
Copy link
Member

In addition to the dependency there are several points in the code where componentWillReceiveProps is still used.
If we are 100% confident on keep using it we can just use the new name UNSAFE_componentWillReceiveProps (also the old name would stop working with React 17), but would be better to refactor the code to completely avoid it.

@giogonzo
Copy link
Member

I would just go with componentDidUpdate for the moment, I doubt there are real cases in the codebase where this makes any real difference compared to using WillReceiveProps

@marcopiii marcopiii added the WIP Issues in progress label Apr 24, 2020
@marcopiii marcopiii self-assigned this Apr 24, 2020
@kanbanbot kanbanbot removed the WIP Issues in progress label May 8, 2020
marcopiii added a commit that referenced this issue May 8, 2020
…as_been_renamed

#1435: componentWillReceiveProps has been renamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants