Hi,
Soon, I have to think about a total rework of a project, currently in Symfony, to a React app. I already have work on two back-office/dashboard with CRA but I discovered this year Next.js and loved it. I would tend to go with Next.js for this project but I am wondering if this is a good choice because, for the moment, there is no SSR/SSG planned.
The arguments to go with Next.js are for me:
Zero config
Fast Refresh
File-systeme routing
API routes
Code splitting and bundling
Avoid the problem with refresh/direct link with react-router
Automatic Static Optimization
Ok, SSR/SSG is not planned but if one day we need it, it would be much easier to implement
I really like all those features but opinions around Next.js seems to be: "if you want SSR go with Next.js, otherwise go with CRA"
I would love to have your opinions to know if Next.js is a bad idea to go for a project that does not seems to need SSR or if it is totally ok. Do not hesitate to share your experiences if you have already done a full CSR project with Next.js
Thx
Top comments (5)
Even if you don't plan to use SSR/SSG, Next.js is a great choice imo, since it removes many pain points from CRA (routing, head stuff etc.). I just finished a big project (operative dashboard) that also didn't make any use of SSR, instead all the data was fetched on client side – it never felt like "Next isn't made for this".
You may never need to do SSR. The only real benefit is faster time to paint for the initial page view. Unless that is really important for your application, then I would stay away from it because of all the added complexity. The other often cited benefit of SSR is better SEO and supporting page previews on third party websites (e.g. linking a page on Twitter). But, you can also achieve this by prerendering your pages in a headless browser only for those bot user agents (check out rendertron or prerender.io).
Nextjs has some clear advantages like SSR and SSG (even Incremental Static Regeneration) but you can use it with other ambitions. Things like not having to deal with react-router-dom (or any other routing library) or the Image Optimization plugin can be useful too, it's also easy to set up better SEO.
My rule of thumb is that if you know React well enough and know what problems Nextjs solves over a CRA project, go on, there's a video from Next Conf called When not to use Next.js that might fit your questions.
you can always use export if you only plan to have static pages.
Also, next js is always looking for ways to make app builds fast via swc or other means. They also update their libraries a lot and update frequently to improve dev experience. It has good foundation to build on. Can't go wrong with nextjs... unless you don't use react with it for some reason. Preact support is spotty since they do more to get react working with it.
Use Next.js imo. Next.js isn't just for SSR and SSG.