/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
errors/no-router-instance.mdx
15 строк
462 B
Delba de Oliveira
Unify caching story across the docs (#90149)
03 мар 2026, 16:14
Не верифицирован
03 мар 2026, 16:14
c2b4c08
Код
Авторство
О чём код?
--- title: No Router Instance --- ## Why This Error Occurred During Prerendering (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.