Converting a site to Nextjs

Hello there, I’m new to Next and I am trying to get this template to Nextjs. But I’ve been stuck trying to get the:

<script>
document.addEventListener(“DOMContentLoaded”, function (event) {
masonryBuild();
});
</script>

A…


This content originally appeared on DEV Community and was authored by DEV Community

Hello there, I'm new to Next and I am trying to get this template to Nextjs. But I've been stuck trying to get the:

<script>
  document.addEventListener("DOMContentLoaded", function (event) {
     masonryBuild();
  });
</script>

At this point I don't know what to do anymore.
This is what I have:

<Script
        id="load-content"
        dangerouslySetInnerHTML={{
          __html: `document.addEventListener("DOMContentLoaded", function (event) {
            masonryBuild();
          });`,
        }}
      />
      <Script
        id="load-content2"
        dangerouslySetInnerHTML={{
          __html: `document.addEventListener("DOMContentLoaded", function (event) {
            navbarToggleSidebar();
            navActivePage();
          });`,
        }}
      />
      <Script src="/main.js" />
      <Script src="/mine.js" />

It's supposed to work, but it's not!


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-02-22T23:26:43+00:00) Converting a site to Nextjs. Retrieved from https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/

MLA
" » Converting a site to Nextjs." DEV Community | Sciencx - Tuesday February 22, 2022, https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/
HARVARD
DEV Community | Sciencx Tuesday February 22, 2022 » Converting a site to Nextjs., viewed ,<https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/>
VANCOUVER
DEV Community | Sciencx - » Converting a site to Nextjs. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/
CHICAGO
" » Converting a site to Nextjs." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/
IEEE
" » Converting a site to Nextjs." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/. [Accessed: ]
rf:citation
» Converting a site to Nextjs | DEV Community | Sciencx | https://www.scien.cx/2022/02/22/converting-a-site-to-nextjs/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.