Client-Side Routing

The URL is application state — shareable, bookmarkable and restorable. Route matching, nesting, history, scroll restoration and the loading boundaries in between.

Client-Side Routing

Intercept the link, match the URL, swap the view — and inherit every job the browser was quietly doing during a real navigation.

Q · What does a client router actually replace, and what does the browser stop doing for me the moment I intercept a link?
Route Matching

How a path becomes a route: segmentation, patterns, specificity, ranking versus ordering, and the nested match chain that renders a page.

Q · Given a URL, how does a router decide which route owns it — and why do two routes ever both look right?
URL Parameters

Path params identify, query params refine — and both are untrusted strings that have to be parsed, validated and canonicalised before anything renders.

Q · What belongs in the path, what belongs in the query string, and who is responsible for the fact that all of it is a string typed by a stranger?
History and Navigation

The session history stack, `pushState` versus `replaceState`, `popstate`, and why intercepting navigation without handling back is the most common router bug there is.

Q · What does the history stack actually hold, and why is the back button the hardest part of a client router to get right?
Scroll Restoration

The browser does this well and single-page applications break it: `history.scrollRestoration`, restoring on back but not on a forward navigation, and the async data problem that puts you in the wrong place.

Q · Why does back land in the wrong place in my single-page application when the same site got it right as a set of ordinary documents?
Route Loading Boundaries

Where the spinner belongs: the subtree a fallback is allowed to replace, why nesting them matters, and why one boundary at the top blanks the whole page on every navigation.

Q · Where should the loading state live, and why does my entire page go blank every time someone clicks a link?