rsnext/errors/no-router-instance.mdx
Delba de Oliveira 44d1a1cb15
docs: Migrate error messages to MDX and App Router. (#52038)
This PR is part of a larger effort to migrate error messages to MDX and
use App Router: https://github.com/vercel/front/pull/23459
2023-07-05 06:11:16 -07:00

15 lines
463 B
Text

---
title: 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.