Skip to content

Commit

Permalink
Add onLoad gotcha note to basic-features doc (vercel#36261)
Browse files Browse the repository at this point in the history
vercel#33097 adds a note to the `Script` documentation explaining that `onLoad` cannot be used with the `beforeInteractive` strategy. However, this note was missing in the [Basic Features](https://nextjs.org/docs/basic-features/script) documentation, causing some confusion. This adds the note there too.

This will hopefully fix a lot of confusion noted in vercel#33191.
  • Loading branch information
davidbarker authored Apr 19, 2022
1 parent 4a8a3d2 commit 44c7fd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/basic-features/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ export default function Home() {
}
```

> **Note: `onLoad` can't be used with the `beforeInteractive` loading strategy.**
Sometimes it is helpful to catch when a script fails to load. These errors can be handled with the `onError` property:

```jsx
Expand Down

0 comments on commit 44c7fd7

Please sign in to comment.