Hey Vimalraj! This one's a tricky one. Essentially it will depend on your use case, and you should probably be able to find a way to achieve a similar thing using simpler hooks. componentWillReceiveProps has been deprecated for a couple of reasons but my understanding is it was generally misused.
My general advice would be; replace it with a useEffect hook, and then use a custom hook to check the previous state. I haven't written about a hook to use previous values, but the logrocket blog has a great example.
I'll update the post to include this! Thank you
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Vimalraj! This one's a tricky one. Essentially it will depend on your use case, and you should probably be able to find a way to achieve a similar thing using simpler hooks.
componentWillReceiveProps
has been deprecated for a couple of reasons but my understanding is it was generally misused.My general advice would be; replace it with a
useEffect
hook, and then use a custom hook to check the previous state. I haven't written about a hook to use previous values, but the logrocket blog has a great example.I'll update the post to include this! Thank you