next/script tối ưu loading third-party scripts.
- Strategies:
beforeInteractive(trước hydration, cho critical scripts),afterInteractive(sau hydration, default),lazyOnload(idle time),worker(web worker với Partytown). - Tránh dùng thẻ script thông thường trong App Router, dùng next/script thay thế.
next/script optimizes third-party script loading.
- Strategies:
beforeInteractive(before hydration, for critical scripts),afterInteractive(after hydration, the default),lazyOnload(during browser idle time),worker(offload to a web worker via Partytown). - Avoid raw script tags in the App Router — use next/script instead.