While making a portfolio website with Next.js, this is some sort of scrolling error that I'm getting from .next folder in my project folder.
Whenever I'm trying to get the mobile responsive view of the website this is the error I'm facing
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'scrollTo')
This is the location of the error file
.next\static\chunks\pages\index.js (14:16) @ scroll
This is the code in that location
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
This is the snapshot of the error
I can run the website locally even when the error is showing. Is it gonna be a buggy thing if I deploy it?
How do I fix this?

window.scrollToinstead..nextfolder, same location, same code block.