What is new in react router dom version 6?

virat sharma
1 min readFeb 5, 2022

Nested Routing

Thanks to React Router v6 now we can easily use nested routing. Previously making a nested routing is big mess and complex process to mange it. We usually need to add manual code in our component to handle diff nested routing.

is relative now because of nesting.

Now instead of component prop we can use element prop in Route component.

Multiple Routes

Previously we can use only Routes one time in our React app. But now we can use multiple Routes in our React App which gonna help us to manage multiple application logic based on different routes.

useNavigate Instead of useHistory

Thanks to React Router v6 we can easily handle redirecting logic using the useNavigate hook.

<Switch> Is Now <Routes>

This top-level component is going to be renamed. its functionality is mostly same.

You may see documentation for more.

--

--

virat sharma
0 Followers

i am passionate about technology