Next.js Discord

Discord Forum

can't find import Script from 'next/script'

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
first, i'm not good at English, i hope you understand.
i want to use <Script> tag.
but there isn't way to find 'next/script'

version is next14

2 Replies

@Barbary Lion first, i'm not good at English, i hope you understand. i want to use <Script> tag. but there isn't way to find 'next/script' version is next14
Silver Marten
you can just do this using the react useEffect hook i'm pretty sure
useEffect(() => {
  const script = document.createElement("script");
  script.src = "foo";
  document.body.appendChild(script);

  return () => {
    document.body.removeChild(script);
  }
}, []);
but it's better if you just find the module you want in npm and import it instead of doing this