Error: No router instance found. You should only use “next/router” inside the client side of your app

Youssef Samih
Apr 25, 2021

this error it happens when you try to use next/router inside some page directly of next js because of page it’s server side rendering SSR or SSG

while this can be fixed by calling router inside useEffect of the page with array depth empty or componentDidMount if you work with classes for now i will go with hooks useEffect her’s how in code source example

I hope this helps if there’s any question or correction you can contact me at:

My linkedin: https://www.linkedin.com/in/youssef-samih

Twitter: https://twitter.com/YoussefSamih97

--

--

Youssef Samih

Web, mobile developer I am more passionate about everything related to JavaScript development and and his frameworks like React, node, react native for mobile