React Router Crash Course
freeCodeCamp.org
View ChannelAbout
Learn math, programming, and computer science for free. A 501(c)(3) tax-exempt charity. We also run a free learning interactive platform at freecodecamp.org
Latest Posts
Video Description
React Router is commonly used to make different routes for pages in React Applications. This crash course will teach you how to create routes in your React applications. This course covers BrowserRouter, Switch, Nesting Routes, Redirecting Routes, match and history props, including useHistory, useParams, useLocation, and useRouteMatch Hooks. ✏️ Course created by Roadside Coder. Check out his channel: https://www.youtube.com/c/RoadsideCoder 🔗 8 clean code practices: https://www.youtube.com/watch?v=dZXpgP9ibf8 ❤️ Try interactive React courses we love, right in your browser: https://scrimba.com/freeCodeCamp-React (Made possible by a grant from our friends at Scrimba) ⭐️ Course Contents ⭐️ ⌨️ (00:00) Intro ⌨️ (00:51) Initialize new React App ⌨️ (03:16) Header Component ⌨️ (04:42) React Router Installation ⌨️ (05:15) BrowserRouter ⌨️ (05:57) Creating Routes ⌨️ (08:21) Testing Routes ⌨️ (08:39) 'exact' prop ⌨️ (09:25) Switch Tag ⌨️ (10:17) Link Tag ⌨️ (13:32) basename prop ⌨️ (14:06) forceRefresh Prop ⌨️ (14:37) getUserConfirmation ⌨️ (15:54) scroll to top on route change ⌨️ (16:46) 404 Not Found Page ⌨️ (18:21) Access URL Params ⌨️ (20:33) useParams Hook ⌨️ (21:50) useLocation Hook ⌨️ (24:49) Redirecting in React Router ⌨️ (28:05) useHistory Hook ⌨️ (30:55) Nested Routing ⌨️ (38:27) Outro 🎉 Thanks to our Champion and Sponsor supporters: 👾 Wong Voon jinq 👾 hexploitation 👾 Katia Moran 👾 BlckPhantom 👾 Nick Raker 👾 Otis Morgan 👾 DeezMaster 👾 Treehouse -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://freecodecamp.org/news
Upgrade Your Everyday
AI-recommended products based on this video

Amazon Echo Show 8 (newest model), With Spatial Audio, Smart Home Hub, and Alexa, Charcoal

Apple AirPods 4 Wireless Earbuds, Bluetooth Headphones, with Active Noise Cancellation, Adaptive Audio, Transparency Mode, Personalized Spatial Audio, USB-C Charging Case, Wireless Charging, H2 Chip

Wireless Earbuds, Bluetooth 5.4 Headphones, True Wireless Stereo Earphones with IPX7 Waterproof, Noise Cancelling Mic, Fast Charging and Comfort Fit Ear Buds for Sports/Workouts - Black

Apple AirPods 4 Wireless Earbuds, Bluetooth Headphones, Personalized Spatial Audio, Sweat and Water Resistant, USB-C Charging Case, H2 Chip, Up to 30 Hours of Battery Life, Effortless Setup for iPhone

Apple AirPods Pro 2 Wireless Earbuds, Active Noise Cancellation, Hearing Aid Feature, Bluetooth Headphones, Transparency, Personalized Spatial Audio, High-Fidelity Sound, H2 Chip, USB-C Charging

Smart Watch for Men/Women, 1.95" AMOLED Fitness Tracker Watches with Bluetooth Calls/Flashlight/100+ Sport Modes Heart Rate/Sleep Monitor Ultra Lightweight Ultrathin Design

Smart Watch for Men Women (Answer/Make Call), 1.96" HD Smartwatch Fitness Activity Tracker, 110+ Sports IP68 Waterproof, Heart Rate/Sleep Monitor/Pedometer/Calories, Fitness Watch for Android iOS
![Apple Watch Series 10 [GPS 46mm case] Smartwatch with Rose Gold Aluminium Case with Light Blush Sport Band - M/L. Fitness Tracker, ECG App, Always-On Retina Display, Water Resistant](https://m.media-amazon.com/images/I/61nNNMI1cFL._AC_UL960_FMwebp_QL65_.jpg)
Apple Watch Series 10 [GPS 46mm case] Smartwatch with Rose Gold Aluminium Case with Light Blush Sport Band - M/L. Fitness Tracker, ECG App, Always-On Retina Display, Water Resistant
![Apple Watch Series 10 [GPS 42mm case] Smartwatch with Jet Black Aluminium Case with Black Sport Band - S/M. Fitness Tracker, ECG App, Always-On Retina Display, Water Resistant](https://m.media-amazon.com/images/I/6105jZyXyPL._AC_UL960_FMwebp_QL65_.jpg)
Apple Watch Series 10 [GPS 42mm case] Smartwatch with Jet Black Aluminium Case with Black Sport Band - S/M. Fitness Tracker, ECG App, Always-On Retina Display, Water Resistant

NOCO Boost GB40: 1000A UltraSafe Jump Starter – 12V Lithium Battery Booster Pack, Portable Jump Box, Power Bank & Jumper Cables - for 6.0L Gas and 3.0L Diesel Engines

UGREEN Nexode Power Bank 20000mAh 130W Portable Charger 72Wh PD Fast Charging 3-Port USB C Battery Pack with TFT Smart Display for MacBook/iPad/iPhone 16/Samsung S24 and More

ANKER 737 Power Bank, 24,000mAh 3-Port Laptop Portable Charger with 140W Fast Charging, Smart Display, for Outdoor Work, Compatible with iPhone 16/15/14 Series, Vision Pro, Samsung, MacBook, and More

VOLTME Portable Charger, Slim 10000mAh 5V/3A Power Bank, USB C in&Out High-Speed Charging Battery Pack, Travel Essentials Dual Output Compatible with iPhone 16 15 14 13 12 Samsung Google iPad etc

Apple AirPods 4 Wireless Earbuds, Bluetooth Headphones, with Active Noise Cancellation, Adaptive Audio, Transparency Mode, Personalized Spatial Audio, USB-C Charging Case, Wireless Charging, H2 Chip

Apple AirPods 4 Wireless Earbuds, Bluetooth Headphones, Personalized Spatial Audio, Sweat and Water Resistant, USB-C Charging Case, H2 Chip, Up to 30 Hours of Battery Life, Effortless Setup for iPhone

Apple AirPods Pro 2 Wireless Earbuds, Active Noise Cancellation, Hearing Aid Feature, Bluetooth Headphones, Transparency, Personalized Spatial Audio, High-Fidelity Sound, H2 Chip, USB-C Charging

Bose QuietComfort Bluetooth Headphones, Wireless Headphones with Active Over Ear Noise Cancelling and Mic, Deep Bass, Up to 24 Hours of Playtime, White Smoke

Barnyard Designs Indoor Herb Garden Planter Set with Tray, Metal Windowsill Plant Pots with Drainage for Outdoor or Indoor Plants, Set/3 (Black)

Eye Contact Web Camera for Desktop Computer – 1080P USB Camera with Microphone & Stand, Center Cam for Laptop or Desktop, Manual Focus, Plug & Play for macOS & Windows(Black)
![PEHAEL 3+3Pack for iPhone 17 Pro Max Privacy Screen Protector with Camera Lens Protector Full Coverage Anti-Spy Tempered Glass Film 9H Hardness Easy Installation Bubble Free [6.9 inch]](https://m.media-amazon.com/images/I/61PnVkv6KKL._AC_UL960_FMwebp_QL65_.jpg)
PEHAEL 3+3Pack for iPhone 17 Pro Max Privacy Screen Protector with Camera Lens Protector Full Coverage Anti-Spy Tempered Glass Film 9H Hardness Easy Installation Bubble Free [6.9 inch]
![Ailun 3 Pack Screen Protector for iPhone 16 Pro Max [6.9 inch] + 3 Pack Camera Lens Protector with Installation Frame,Sensor Protection,Dynamic Island Compatible,Case Friendly Tempered Glass Film](https://m.media-amazon.com/images/I/815keamN-BL._AC_UL960_FMwebp_QL65_.jpg)
Ailun 3 Pack Screen Protector for iPhone 16 Pro Max [6.9 inch] + 3 Pack Camera Lens Protector with Installation Frame,Sensor Protection,Dynamic Island Compatible,Case Friendly Tempered Glass Film







![How to build your own learning path using Open Source with Kunal Kushwaha [Podcast #200]](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/VgBQ0yBSjfM/hqdefault.jpg)
![Harvard CS50 prof David J. Malan on why you should learn programming slowly [Podcast #197]](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/ZK6XWSCCgPQ/hqdefault.jpg)











![How to turn Open Source into a Job with Nick Taylor [Podcast #181]](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/m7nkioXNiik/hqdefault.jpg)

![Google Cloud Associate Cloud Engineer Course [2025] - Pass the Exam!](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/OlAmyf8_4O4/hqdefault.jpg)



![How to Survive in Tech When Everything's Changing w/ 21-year Veteran Dev Joe Attardi [Podcast #174]](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/07NdHM6pE6M/hqdefault.jpg)




![Getting a developer job in 2025 with Lane Wagner [Podcast #157]](https://imgz.pc97.com/?width=500&fit=cover&image=https://i.ytimg.com/vi/wjj2gZbcoNw/hqdefault.jpg)







