0
Challenge · 47Routing & Data

Search Params

Coreused in ~60% of apps

A user filters your product page to "red shoes, sorted by price," finds the perfect pair, and pastes the link to a friend — who opens an empty, unsorted list. The filter lived in useState, so it vanished the moment the URL was shared. Search params fix this by storing that view-state in the URL itself.

Core idea. The query string (everything after the ? — ?q=shoes&sort=price) is shareable, bookmarkable UI state; useSearchParams() reads it like state and gives you a setter that updates the URL instead of a private variable.
Playground, this isn't a screenshot
SHAREABLE URL
myapp.com/products
Apex Chair$210
Atlas Backpack$92
Aurora Lamp$48
Nova Pen$9
Pixel Mug$14
Pulse Watch$120

The filter lives in the URL, not in a private useState. Reload, bookmark, or send that link and the exact same 6-item view comes back — that is what local state can never do.

↑ play a little first, then dig in