Skip to content

Commit

Permalink
Clarify in docs that next/script must not be in next/head (#27534)
Browse files Browse the repository at this point in the history
Documentation to help future developers avoid #27498 

## Documentation / Examples

- [X] Make sure the linting passes
  • Loading branch information
zackdotcomputer authored Aug 1, 2021
1 parent f9ebc77 commit 807d1ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/basic-features/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export default function Home() {
}
```

With `next/script`, you no longer need to wrap scripts in `next/head`. Further, `next/script` should **not** be used in `pages/_document.js` as `next/script` has client-side functionality to ensure loading order. For example:
Now, you use `next/script` in the body of your Next.js page. It has client-side functionality that decides when and how to load the remote script based on the `strategy`.

> **Note:**
>
> - `next/script` **must not** be placed in either a `next/head` component or in `pages/_document.js`.
```js
// After
Expand Down

0 comments on commit 807d1ec

Please sign in to comment.