react-infinite-scroll-component icon indicating copy to clipboard operation
react-infinite-scroll-component copied to clipboard

componentWillReceiveProps has been renamed

Open jaexplorer opened this issue 7 years ago • 11 comments

  • 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?

jaexplorer avatar Oct 04 '19 13:10 jaexplorer

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.

edekk avatar Oct 11 '19 11:10 edekk

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.

Falkyouall avatar Jan 15 '20 14:01 Falkyouall

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 avatar Jan 15 '20 14:01 ankeetmaini

@ankeetmaini thank you.

Falkyouall avatar Jan 15 '20 14:01 Falkyouall

@Falkyouall latest release has this change? I see in master the method was renamed to "UNSAFE_ComponentWillReceiveProps". You shouldn't be getting any warnings.

ankeetmaini avatar Jan 20 '20 11:01 ankeetmaini

Im still seeing this warning when using the official npm install package. am i doing something wrong?

AmitNeuhaus avatar Apr 24 '20 22:04 AmitNeuhaus

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.

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.

NithinRauj avatar May 24 '20 17:05 NithinRauj

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.

akkisagiraju avatar Jun 10 '20 06:06 akkisagiraju

Why close ? This issue is still present in strict mode... How to fix it ?

tigerblue77 avatar Feb 22 '21 21:02 tigerblue77

It has trouble. It didn't fix. What should I do?

ali-taghipour avatar Feb 27 '21 03:02 ali-taghipour

I agree! The problem is not solved!

Comediant24 avatar Feb 28 '21 04:02 Comediant24