Dashboard
10 / 60
DAY 10 OF 60hardDone

React Router + protected routes

#react-router#auth#spa#protected-routes

Your Work

Single Page Apps live and die by their routing. Add React Router to your frontend, create a login/register page, and protect routes behind an auth check. Your JWT from the backend is now driving the frontend too.

  1. Routes: /, /login, /register, /dashboard (protected)
  2. Redirect unauthenticated users from /dashboard to /login
  3. Store JWT in memory (not localStorage — explain why in your post)
  4. Handle token expiry — redirect to login, clear state
  5. Add a loading spinner during auth check on mount

ABTALKS

60-Day Challenge

12

day streak

Day 10

React Router + protected routes

Your chain

7
8
9
10
11
12
13

Arjun Mehta

Full Stack Dev

abtalks.vercel.app

Day Info

TrackFull Stack Dev
Date6 Aug 2026
DifficultyHard