DEV Community

Cover image for React Router V5 vs V6

React Router V5 vs V6

Arunava Modak on November 14, 2021

React Router version 6 was released recently, and it is important for us to understand the changes as it is one of the most widely used react libra...
Collapse
 
rkganeshan profile image
rkganeshan

Hey @arunavamodak , liked this blog. Crisp content ; differences of the versions as well as the new implementation is dealt very well.

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
 
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.

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
 
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
 
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
 
swastikyadav profile image
Swastik Yadav

Hey Arunava, Thanks for such nice and detailed explanation about the changes in react-router v6.

Collapse
 
arunavamodak profile image
Arunava Modak

Thanks man. Just looking to contribute something to the community

Collapse
 
th3c0r profile image
th3c0r

Very nice article! Also a good video tutorial from Academind youtu.be/zEQiNFAwDGo

Collapse
 
rancy98 profile image
rancy98

quality sharing!

Collapse
 
ferdiansyah0611 profile image
Ferdiansyah

nice👏

Collapse
 
kpervin profile image
Kristofer Pervin • Edited

At some point can you add in built-in Protected Routes? It would be quite the convenience feature. Otherwise this looks great!

Collapse
 
77pintu profile image
77pintu

Thanks for the great post!!!

Collapse
 
multiwebinc profile image
Mike Robinson

There's also an official upgrading guide: github.com/remix-run/react-router/...

Collapse
 
essitcophp5 profile image
nikhil

very good explanation 👌

Collapse
 
danielouattara profile image
Daniel OUATTARA

Thank you !

Collapse
 
shamolmojumder profile image
Shamol Mojumder

Thanks Arunava Modak for make it so easy.