useInsertionEffect chạy trước bất kỳ DOM mutations nào, trước cả useLayoutEffect.
- Được tạo ra dành cho CSS-in-JS libraries để inject styles trước khi component render, tránh flash of unstyled content.
- Không nên dùng trong application code thông thường, chỉ dành cho library authors.
useInsertionEffect fires before any DOM mutations, even before useLayoutEffect.
- It was designed specifically for CSS-in-JS libraries to inject styles before components render, preventing a flash of unstyled content.
- It should not be used in application code — it is intended only for library authors.