useEffect(fn, []) is not the new componentDidMount()
- They’re actually mechanically different, so you might not get what you expect if consider them the same (which we talk about below).
- Thinking in terms of time, like “call my side effect once on mount” can hinder your learning of hooks.
- Refactoring from classes to hooks will not mean you simply replace your componentDidMount’s with useEffect(fn, []).