DEV Community

Discussion on: Next.js vs React: Which One to Choose for Your App?

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

I'm a bit confused with this:

Use React when:
  • You need a highly dynamic routing
  • You’re already familiar with JSX
  • You need offline support
Use Next.js when:
  • You need an all-inclusive framework
  • You require backend API endpoints
  • You need server-side rendering

Reasons:

  • Next JS implements React. Anything that you can do with React is also possible inside Next JS the same way you'll use JSX inside Next frontend part (React).

  • The routing inside Next is based on file-system (easy to begin with, no config required like in React Router) and has the same flexibility at the end, or in other words, you can achieve the same with one or the other, it's just that in React (without Next) you need to manually define the routes.

  • The "offline support" is not provided in any case "as is", you'll need to code a web worker anyway. As example, you can also use next-pwa to have your app converted to a PWA easily which already implements a web worker.

  • Also note that most -serious- production react projects don't use CRA to begin with. CRA is just OK for learning purposes but getting all those opinionated generic dependencies, webpack as the only option and so on is not suitable for custom apps, where you set up the things regarding the project needs with a previous analysis.

I've been asked about the difference a couple of times, if I must, let me pin here a comment on that:

Hi @fyodorio it just depends on your needs.

Even if you've your services/micro-services on a different place, you can use the Server Side Rendering feature, this way your web app will be SEO-friendly.

Next Js is a framework (that implements React), so it brings a bunch of features on the top of it.

Maybe you find any feature that suits your project/s (Image or Fonts Optimisation, Routing, Static File Serving...). Also when dealing with more than a single project, using a framework can be a standard way to deal with those common tasks.

If you don't need (and analysis suggest you won't need in the future) SSR nor SSG and also you've the services somewhere else then maybe React is more suitable 😁

If it's the case and you go for React "only" I still recommend you to do a PoC with Next just to get some experience and find opportunities to use it later on.

So answering the question: Yes, it bring other sweet benefits, the question is if your specific project needs are aligned with what Next can offer 🙂

Source

I understand that you're selling a product but it will be more convincing to me with a previous deep analysis 😅

Best regards