rsnext/errors/no-router-instance.md
Azeez Lukman 00d453d74b
expanded on No Router Instance (#21248)
Added more detailed explanation of why there is no router instance, and other ways to fix the error
2021-01-26 10:27:53 +00:00

13 lines
454 B
Markdown

# No Router Instance
#### Why This Error Occurred
During Pre-rendering (SSR or SSG) you tried to access a router method `push`, `replace`, `back`, which is not supported.
#### Possible Ways to Fix It
In a function Component you can move the code into the `useEffect` hook.
In a class Component, move any calls to router methods to the `componentDidMount` lifecycle method.
This way the calls to the router methods are only executed in the browser.