As a novice in Nextjs, I am attempting to incorporate a basic JavaScript function like this:
document.addEventListener("scroll", function () {console.log("scroll!")})
How can I add this function in a local file and then load it using <script/>
in Nextjs?
P.S: I created a .js file with the function inside the project folder and attempted to load it using the next Script component, but encountered this error: Failed to load resource: the server responded with a status of 404 (Not Found)