I am trying to check my page slug in a function and I get an error
Server Error
ReferenceError: window is not defined
I have another function that it works great in...
function Page() {
const thisPage = window.location.pathname.slice(1);
console.log(thisPage);
....
Today I am trying to use it here below, but I get the error above
export default function Page() {
const thisPage = window.location.pathname.slice(1);
console.log(thisPage);
Why does the code work in one function but not the other?