Components

Script component loading strategies

Schedule reviewed scripts according to criticality. lazyOnload defers low-priority work, and the worker strategy is experimental and unsupported in App Router. A loading strategy does not sandbox a script; review content, consent and CSP separately. Source: https://nextjs.org/docs/app/api-reference/components/script. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
import Script from "next/script"; <Script src="/enhancement.js" strategy="lazyOnload" />

Working Example

Example Snippetnextjs
import Script from 'next/script';export default function Page(){return <main><h1>Catalog</h1><Script src='/enhancement.js' strategy='lazyOnload'/></main>;}
Next.js Reference