How To Build a Custom Hook As componentDidUpdate Alternative

Since useEffect doesn’t work as expected

componentDidUpdate hook
Source: the author

As much as I love React hooks, there is a little problem: They are less intuitive compared to lifecycle methods in class-based components. As a consequence, replacing lifecycle methods like componentDidUpdate with the useEffect-hooks leads to unwanted…