很好,這樣順多了🫠
還沒有人留言。想成為第一個嗎?
開發 mur457 篇文章
不是很重要
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.