Y
Y
Yzurgzd2020-12-08 20:47:58
React
Yzurgzd, 2020-12-08 20:47:58

Not working script on client in Next.JS?

In _document.js I connected the script through head

<Head>
    <script
        type="text/javascript"
        src="/static/vendor/jquery/dist/jquery.min.js">
    </script>
    <script
        type="text/javascript"
        src="/static/vendor/jquery-migrate/dist/jquery-migrate.min.js">
    </script>
    <script
        type="text/javascript"
        src="/static/vendor/bootstrap/dist/js/bootstrap.bundle.min.js">
    </script>
</Head>

Everything works, but when going through the Link, the script on the page doesn't work. At the same time, in head, all scripts are present.
<Link
    href={`/product/[slug]`}
    as={`/product/${product.slug}`}
>
    <a className="text-inherit">{product.name}</a>
</Link>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question