In class components, this is my code to fetch URL/Path but it is not working. I guess it is probably because my project is using nextJS(9.3.0) not react-router
fetch_window_URL = () => {
let ddd = window.location.href;
console.log(`URL is ${ddd}`)
let ccc = window.location.pathname;
console.log(`Path is ${ccc}`)
}
ReferenceError: window is not defined
My ultimate goal is to get a unique string value from URL-Path. I believe, I can achieve it by fetch URL-Path which will give me a string value, & then I will extract a sub-string(which i want) from that URL string. The URL i am fetching doesn't have query params in it, It is just a pathname(string value).