componentWillReceiveProps has been renamed
See original GitHub issue- 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: InfiniteScroll
I get this warning in my console constantly. Am I using InfiniteScroll incorrectly or this legit something that needs to be addressed?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:11 (2 by maintainers)
Top Results From Across the Web
reactjs - componentWillReceiveProps has been renamed
Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the ...
Read more >Warning: componentWillReceiveProps has been ... - GitHub
componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
Read more >Warning: componentWillMount has been Renamed, and is not ...
Learn what causes "Warning: componentWillMount has been renamed, and is not recommended for use."
Read more >componentWillReceiveProps has been renamed - React Studio
Move data fetching code or side effects to componentDidUpdate. · Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in ...
Read more >Reactjs – componentWillReceiveProps has been renamed
react-dom.development.js:12466 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See for details.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using this in strict mode is resulting in a warning message.
Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code.
To overcome this issue browse
{your_project}\node_modules\react-infinite-scroll-component\lib\index.js
and change:key: "componentWillReceiveProps", value: function componentWillReceiveProps(props) { ...
into:key: "componentDidUpdate", value: function componentDidUpdate(props) {...
Keep in mind you edit the build version, so for good measure you could also edit pre-build file (
{your_project}\node_modules\react-infinite-scroll-component\app\index.js
) and change function names there as well.