useSyncExternalStore:把你的 Vibe-coded app 從 state bug 裡救出來的 React Hook
別再寫那些會 memory leak、會漏掉 state update 的 useEffect subscription 了。這是 React 18 用來打造 bulletproof external state 的 pattern。
我以前寫 network detection hook 的方式,和大多數 vibe coder 沒什麼兩樣:一個 去 subscribe NetInfo,在 connectivity 改變時更新 state,然後祈禱一切順利。它在 development 裡能跑,在 production 裡會出事。 race…