Physics is the universe's operating system. -- Steven R Garman

Event Handling

Next Script uses the html script. It provides 3 events: `onLoad`, `onReady`, `onError`.

For scripts loaded using beforeInteractive, `onLoad` event is not available.

Sample Code

import Script from 'next/script';
<Script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js"
strategy="afterInteractive"
onLoad={() => {
console.log('script loaded')
}}
onReady={() => {
console.log('script is ready')
}}
onError={() => {
console.log('error loading script')
}}
></Script>