FRAMEWORK » NEXTJS » BUILTIN

Script

Usage

js
import Script from 'next/script'
PropDescription
src[Required] A path string specifying the URL of an external script. Not required if inline script is provided.
strategyThe loading strategy of the script. Values may be: beforeInteractive afterInteractive lazyOnload
onLoadExecute code after it has loaded.
onReadyExecute code after the script's load event when it first loads and then after every subsequent component re-mount.
onErrorExecute code if a script fails to load.

Examples

html
<Script src="https://example.com/script.js" strategy="lazyOnload" />