Next.js Discord

Discord Forum

Is it a bad idea to use NextJS App Router AND SWR for an internal dashboard?

Answered
Glen of Imaal Terrier posted this in #help-forum
Open in Discord
Glen of Imaal TerrierOP
Hi, I'm building an internal dashbaord where SEO isn't important but speed is. I like the idea of using NextJS App Router on this project to keep it cohesive with our other repos, and also a few of the DX things (router, server components for some things, etc.)

However, I'm not totally a fan of ditching SWR and building these custom data retrieval functions. I'd prefer to just stick with SWR for getting my data. The problem then is that I feel like I'm not really getting the most out of the App Router (can't use loading.tsx/error.tsx/etc., everything becomes use client for the most part).

Does anyone have any thoughts that could help me make a decision here?

Thank you!
Answered by joulev
it's completely fine to use the app router with client-side data fetching libraries

* server component: fetch the data
* client component: get the data and use it as the [initial value](https://swr.vercel.app/docs/with-nextjs#pre-rendering-with-default-data), then handle the real time/revalidate/etc. on the client side normally
View full answer

1 Reply