DEV Community

Create a React App with React Router Dom v6

Saleh Mubashar on November 04, 2021

Hi guys! In this post, I will be giving a complete walkthrough on how to create a React App with the help of React Router Dom. React Router v6 i...
Collapse
 
edhovhannis profile image
EdHovhannis

In v6 Switch doesn't working.

Collapse
 
salehmubashar profile image
Saleh Mubashar

Hi
Yes in v6 switch has been replaced by
Routes
That is why I am not using switch in this tutorial.

Collapse
 
kfaizan0496 profile image
kfaizan0496

how to get macth,history,location in v6

Collapse
 
kfaizan0496 profile image
kfaizan0496

Switch replaced by Routes

Collapse
 
salehmubashar profile image
Saleh Mubashar

The tutorial has been updated to include new features in React Router 6

Collapse
 
salehmubashar profile image
Saleh Mubashar

Hmmm good point
I am always messing up :)
Actually i wrote this tutorial a week back.
Will update it soon

Collapse
 
torik17 profile image
Tori

Great walk through! One comment though, technically since this is not jumping to hashlinks and rendering completely different views this would be a multi-page application, not a SPA correct?

Collapse
 
salehmubashar profile image
Saleh Mubashar

Yes it is an application with multiple pages, but since you do not reload the page when navigating to other pages (only the url changes) you are essentially on the same page all the time. So a single page with dynamic content.

Collapse
 
torik17 profile image
Tori • Edited

Ah thank you, professionally I've only worked on MVC/ Multi-Page applications so in my free time I was trying to wrap my head around the SPA architecture and how they are different. I'm implementing this in a pet project and really appreciate the details and time you put into this!

Thread Thread
 
salehmubashar profile image
Saleh Mubashar

Thanks a lot!

Collapse
 
virgilforsyth profile image
Info Comment hidden by post author - thread only accessible via permalink
VirgilForsyth

How to Set Up Router and Route to Other Components . Bring my lover back to me

Some comments have been hidden by the post's author - find out more