Equivalent to componentDidUpdate using React hooks

Posted by Rohit Kumar | Updated on

Equivalent to componentDidUpdate using React hooks. The useRef creates an “instance variable” in functional component. It acts a flag to indicate whether it is in mount or update phase without updating state.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers