DEV Community

Discussion on: React Router V5 vs V6

Collapse
 
henrikvtcodes profile image
Henrik VT

As someone who hasn't used React Router, what's the advantage of using this over a framework like Next.js or Gatsby?

Collapse
 
multiwebinc profile image
Mike Robinson

Next and Gatsby are full-fledged frameworks and do a LOT more than just routing. If you're already using them, there's no need to use React Router.

Collapse
 
lesleyvdp profile image
Lesley van der Pol

I don't think there is an advantage of using React Router over Next.js or Gatsby. If you want the tools that Next or Gatsby offer then it makes sense to just go for those. If you're working on a more vanilla React project then you will generally see something like React Router in place to handle the routing.

Collapse
 
johannesmogashoa profile image
Johannes Mogashoa

React Router is directly plugged into Next without you having to install it as a separate dependency. For instance, with Next when you add a new JS/TS or JSX/TSX file into the pages folder, it will automatically map out the path for you without you having to define it.

Collapse
 
arunavamodak profile image
Arunava Modak

Well it totally depends on the requirement of your project.
If you want an SPA, you can use React and React Router, which takes care of your client-side routing. For something like Next.js it comes with it's own page based routing, I don't think we can implement SPA.