Script Component
The ‘<Script>’ component is a way to include external scripts or libraries in your application. It is often used for loading third-party scripts or adding custom scripts to specific pages. This is a prebuilt Component in Next.js
There are the some Commone Props in <Script/> Component
- src: It is required prop in <Script> Component. This prop define the external javascript url.
- strategy: This prop allow you to control the behaviour of loading and executing the external script.
Example:
import Script from 'next/script'
export default function Page() {
return (
<>
<Script src="https://example.com/script.js"
strategy="afterInteractive" />
</>
)
}
Next.js Components
NextJS is a popular and powerful React Framework that simplifies building modern web applications. It was created by Vercel (formerly Zeit), and NextJS simplifies the process of building modern web applications by providing a robust framework.
Table of Content
- What is a Component?
- Image Component
- Link Component
- Script Component