DEV Community

calebdeji
calebdeji

Posted on • Edited on

NextJS throws error on navigating from the page that imports a script in the head tag

I have been facing an issue with NextJS. I tried to import a CDN script on a particular page. It works on the first load but then throws an error whenever I navigate to another page, thereby making it unusable when navigating to the initial page.

import React, { useState,

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay