componentWillReceiveProps has been renamed
- 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-lifecyclesin 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?
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.
this should be patched by the authors asap. the only other way i see here is to apply npm patch-package. this will edit the wrong-ish npm module every time you type npm install, and therefore the only sustainable way to accomplish this besides waiting for a new release.
Will look into it this weekend. Sorry for the trouble
On Wed, 15 Jan, 2020, 8:01 pm Falk M., [email protected] wrote:
this should be patched by the authors asap. the only other way i see here is to apply npm patch-package https://www.npmjs.com/package/patch-package. this will edit the wrong-ish npm module every time you type npm install, and therefore the only sustainable way to accomplish this besides waiting for a new release.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ankeetmaini/react-infinite-scroll-component/issues/140?email_source=notifications&email_token=ABSYHF3LFGSURIAYSMMRLRDQ54M4JA5CNFSM4I5PRXZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJAP6OY#issuecomment-574684987, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSYHF5GYHMJAVKKB2MGTTTQ54M4JANCNFSM4I5PRXZQ .
@ankeetmaini thank you.
@Falkyouall latest release has this change? I see in master the method was renamed to "UNSAFE_ComponentWillReceiveProps". You shouldn't be getting any warnings.
Im still seeing this warning when using the official npm install package. am i doing something wrong?
To overcome this issue browse
{your_project}\node_modules\react-infinite-scroll-component\lib\index.jsand 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.
Hey @ankeetmaini I am also getting the same warning message.So I tried doing this fix but I couldn't find a lib folder in my node_modules.So how to fix this error ? By the way I also used the official npm package.
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.
Why close ? This issue is still present in strict mode... How to fix it ?
It has trouble. It didn't fix. What should I do?
I agree! The problem is not solved!