React Router 6 Features & Upgradation Guide

The most powerful client-router for React yet

Haseeb Anwar
4 min readNov 30, 2021

React-router is probably the most used package with React. Recently, a new stable version 6 is released with many new features. And personally, I think that this is the best version of react-router so far.

Installation

$ npm i react-router-dom@latest

Switch Is Replaced With Routes

The first major change in v6 is that the Switch component is now replaced with the Routes component.

Ranked Routes

In previous versions of react-router, we have to define our routes in a certain order to get the right render. In v6, route order doesn’t matter.

Consider the snippet written in v5.

--

--