silverwolf-x/project / errors /inline-script-id.mdx
silverwolf-x's picture
download
raw
687 Bytes
---
title: Inline script id
---
> Enforce `id` attribute on `next/script` components with inline content.
## Why This Error Occurred
`next/script` components with inline content require an `id` attribute to be defined to track and optimize the script.
## Possible Ways to Fix It
Add an `id` attribute to the `next/script` component.
```jsx filename="pages/_app.js"
import Script from 'next/script'
export default function App({ Component, pageProps }) {
return (
<>
<Script id="my-script">{`console.log('Hello world!');`}</Script>
<Component {...pageProps} />
</>
)
}
```
## Useful links
- [Docs for Next.js Script component](/docs/pages/guides/scripts)

Xet Storage Details

Size:
687 Bytes
·
Xet hash:
c0623af6e64b726fa53326948d770951ad3127b2460715df0e3aec55e5e71691

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.