Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Learn React Router 6

Enroll for freeGet started!

Join 15618 other students

Log in to get

Access to all our free courses
Interactive hands-on content
100s of code challenges
Join a friendly community
Enroll for free
Subscribe to access!Subscribe to access!

Subscribe to access to this course and ALL other courses. You get a 30-day money-back guarantee, no questions asked.

Subscription includes

All courses and career paths
100s of coding challenges
Certificates of completion
Exclusive Pro members chat
The course creator Bob Ziroll

with Bob Ziroll

Course level: Intermediate

Learn React Router v6, the most popular routing library for React applications and one of the most downloaded React support libraries ever.

What's inside

This course contains 137 interactive scrims spread across 6 modules.

two girls
Actions and Protected Routes

40 lessons2 hours 39 min

1. Initial Login Form
2:22
2. Note from the future: importing image assets in Vite
2:47
3. Protected Routes Intro
5:32
4. Protected Routes - AuthRequired Layout Route
3:37
5. Protected Routes - Conditionally send to /login page
4:03
6. Protected Routes Quiz
1:39
7. Protected Routes - with loaders
4:35
8. Protected Routes w/ loaders
4:20
9. Parallel Loaders demo
3:31
10. Challenge: Protected Routes w/ loaders
1:14
11. Challenge: Protected Routes in VanLife - Part 1
2:06
12. Aside challenge: move remaining fetching to loaders - Part 1
5:33
13. Aside challenge: move remaining fetching to loaders - Part 2
4:27
14. Challenge: Protected Routes in VanLife - Part 2
8:11
15. Send login message prompt to login page
3:01
16. Consume message from search param on login page
7:37
17. Pass message to Login page
3:46
18. 🌶️ Take: Forms in React are bad
2:29
19. Setting up for authentication - happy path
4:50
20. Setting up for authentication - sad path
8:01
21. useNavigate()
3:44
22. React Router Form Component
2:54
23. Setting up the Action function
4:28
24. Add form and action to VanLife
2:14
25. Action function - params
1:37
26. Action function - request
3:24
27. Get form data in VanLife
1:40
28. Use data in action to log in
2:32
29. Better (but still fake) auth
3:41
30. Challenge: send user to /host route after log in
3:23
31. Form replace
5:12
32. useActionData
4:24
33. Action error handling
3:05
34. Action error handling in VanLife
2:58
35. useNavigation()
4:05
36. useNavigation in VanLife
3:56
37. get previous route pathname
6:55
38. redirectTo - part 1
4:21
39. redirectTo - part 2
6:18
40. redirectTo in VanLife
4:43

You'll learn

What are SPAs?

Basic router setup

Route

Link

Route parameters

Nested routes and Outlet

Layout and Index routes

Relative paths

NavLink

Outlet context

Search parameters

Link state

404 page / Splat routes

Loaders

Actions

Form & form data

defer()

Await

Suspense

Error handling & errorElement

useRouteError

useNavigate

useNavigation

useLocation

useLoaderData

useActionData

Protected Routes

Deploying with Netlify

Using Firebase for data storage

You'll build

screenshot
VanLife

An awesome app for renting decked-out travel vans for your next road trip adventure! 🚐

man

Prerequisites

Before taking this course, you should have a basic understanding of JavaScript and React. Below are our suggested resource to get you up to speed.

Meet your teacher

The course creator

Bob Ziroll

Head of Education at Scrimba. Passionate about learning 📚, helping others achieve their career goals 👩‍💻, tennis 🎾, woodworking 🪑, and my family 👨‍👩‍👦‍👦.

Follow me on twitter

Why this course rocks

In this 121-part course, you’ll learn the ins and outs of React Router v6, the most popular routing library for React applications and one of the most downloaded React support libraries ever.

React Router is the primary way most applications handle client-side routing, which allows React developers to create “single-page” web apps. Unlike the name might seem to imply, a “single-page” app is one that has many different web pages that are all handled by the React app directly on the client, without necessarily needing to make extra requests of the server every time the user navigates to a new page.

Instead of loading new pages for each route, a Single-Page App (SPA) updates the document that has already loaded in the browser to display the new information. This leads to an extremely snappy-feeling website that doesn’t have the tell-tale flicker of a site that loads a new HTML page on every route transition.

In this course, you’ll learn the most important parts of the React Router (v6) library while building an app called “VanLife”, an app for renting decked-out travel vans for your next road trip adventure.

This course is filled with interactive coding challenges, small and large, to help drill in the topics you’ll be learning, all while building the main VanLife project. Repetition and practice is the real way to avoid tutorial hell and build the muscle memory needed to truly understand what you’re learning.

So if you’re looking to escape tutorial hell, this course (and Scrimba courses in general) is the way to go!

Don’t forget: learning should never be lonely - that’s why we’ve set up the Scrimba Discord server. Make sure you drop in, say hello, and share your goals and achievements. If you get stuck, there is even a dedicated React help channel.

F to the A oracle to the Q
What even is React Router?

React Router is the most popular 3rd-party (I.e. not developed by the React core team) library for handling client-side routing. At its core, it’s a library built for conditionally rendering certain “pages” depending on the current URL route of the app. (E.g. example.com/about, example.com/contact-us, example.com/products/123, etc.)

Who uses React Router?

With over 10 million downloads per week, it’s safe to say React Router is used by most React applications that need to handle client-side routing. There are alternatives out there (most notably TanStack Router), but none of them are as ubiquitous as React Router at this time.

Who created React Router?

The React Router library was created and is maintained as open source software, primarily by Ryan Florence and Michael Jackson, prominent contributors and figures in the JavaScript community. Those same developers are the creators of a framework called Remix, which was recently purchased by Shopify. React Router plays a large role in the Remix framework, and has thus moved under the umbrella of code by Remix.