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
Brendonovich
Brendonovich2y ago
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.
barry
barry2y ago
What he said, why
低级黑小明👑
I do need client side routing and navigation, the current routing seems lacking. I asked that question myself tho
Brendonovich
Brendonovich2y ago
Next does client side routing - i can understand being frustrated by pages/ tho app/ routing is much nicer
barry
barry2y ago
I like both 🤷 but I hate react router 😂
Brendonovich
Brendonovich2y ago
hey RR v6 is nice
barry
barry2y ago
It’s an improvement to v5 but I still hate it
Brendonovich
Brendonovich2y ago
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
Brendonovich
Brendonovich2y ago
do u use <Route> or config routing?
barry
barry2y ago
Route
Brendonovich
Brendonovich2y ago
yeah idk what the equivalent is - probs a root layout.tsx or something? yeah ok i can understand hating it
低级黑小明👑
I 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
Brendonovich
Brendonovich2y ago
lmao fair
Want results from more Discord servers?
Add your server