0
Challenge · 41Routing & Data

Routing Basics

Coreused in ~95% of apps

A single-page app loads one HTML file and never asks the server for another. So when the user clicks "About" or hits the back button, what decides which screen shows? Routing: the URL becomes a piece of state that picks which component renders — instantly, with no full page reload.

Core idea. Client-side routing makes the URL the source of truth for which component renders. A router watches the address bar, matches the current path against your route table, swaps in the matching component, and updates the URL via the History API — all without a server round-trip or page reload.
Playground, this isn't a screenshot
pulse.app
<Route path="/" element={<Home />} />

Home

Welcome to Pulse. The URL is / so the Home route matched and rendered here.

URL
/
component swaps
0
full page reloads
0

Click a link or type a path and press Go: the URL updates and the matched component swaps in — but the page never reloads. That is client-side routing.

↑ play a little first, then dig in