Is there a specific way to integrate react router in t3?

this may seem trivial but I've had lots of trouble with it.
When I put router(browserRouter) tag around the <component> tag in _app.tsx I always get document is not defined error.
I've tried other places and I get the same error, so I wonder if there's another way to use react router in t3(nextjs) because I've not seen anybody else having this trouble.
my app is only half built but it seems like a lot of work to migrate to app router.
import { Link, Navigate, Routes, Route, BrowserRouter as Router} from "react-router-dom";
<Router>
<Routes>
<Route path='/admin' element={<AdminPage />} />
<Route path='/' element={<Component {...pageProps} />} />
</Routes>
</Router>
Was this page helpful?
Is there a specific way to integrate react router in t3? - Theo's Typesafe Cult