到底是哪個天才在nav bar放幾十個按鈕的
好,是我
🫠
不是很重要
React的useEffect,parent cleanup 會在children cleanup之前執行。
We guarantee that parent effects are destroyed before the child ones. The reason for this is that parents often tend to depend on some resource created by the child. Such as removing a listener from a DOM node managed imperatively by a child. If the child disposes its resources first, the parent might not be able to properly clean itself up. This is not specific to Hooks — it’s how componentWillUnmount works as well.