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>
14 Replies
It's probably possible but... why? Next itself is a router, if you want to use RR you'd probs have an easier time just using Vite.
What he said, why
I do need client side routing and navigation, the current routing seems lacking. I asked that question myself tho
Next does client side routing - i can understand being frustrated by
pages/
tho
app/
routing is much nicerI like both 🤷 but I hate react router 😂
hey RR v6 is nice
It’s an improvement to v5 but I still hate it
only gripes w/ it is no suspense support and lack of type safety
I'd love to move to app router, but I'm scared to move the _app.tsx page, not sure how to do it, I fear spending another day or two fixing building errors
do u use
<Route>
or config routing?Route
yeah idk what the equivalent is - probs a root
layout.tsx
or something?
yeah ok i can understand hating itI think so, but I'm not going to find out anytime soon. I'll let others test it out then. I'm way behind my schedule
lmao fair