How to add inline script in NextJS
here is How to add inline script in your NextJS project
Even in React application, we need vanilla javascript sometimes.
Here is how to add an inline script in NextJS project
import Script from "next/script";
<Script id="script-id">
{
`console.log('123')`
}
</Script>
- import script from next
- add <Script> tag between your custom javascript code
- The id is important here! make sure you add an Id to your script