React Hooks: How to implement "exact" componentDidUpdate alternative
TL;DR
— If you don’t want useEffect to be executed when a class is loaded, use a boolean value to detect it
— To detect a change of an element, toggle boolean value instead of setting true/false value