ReferenceError: window is not defined, when trying to sync the search input state with react instant search

I am using next js and I am trying to sync my search state with url query params, so that during navigation I don’t lose my search input state. I know that it’s a sever side language, but what can I do to make this code work with window object? This is a code snippet … Read more