silverwolf-x/project / errors /no-router-instance.mdx
silverwolf-x's picture
download
raw
462 Bytes
---
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.

Xet Storage Details

Size:
462 Bytes
·
Xet hash:
e5f8638b4f50870022efd8723738de0997af4fbfbd9a1b3162918862e9f2cf16

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.