Day 24: URL Query Params (state in URL)
Build a small filter/search UI where the selected state is saved in the URL.
JavaScript focus
- URLSearchParams
- window.location.search
- Reading query params
- Setting query params
- Updating the browser URL with history.pushState() or history.replaceState()
- Keeping UI state in sync with the URL
- Restoring state on page load
Nice extras (pick 1-2 max)
- Clear filters button
- Result count
- Empty state
- Preserve query params when multiple filters change
- Use popstate so browser back/forward restores previous states
- Remove empty params from the URL