State Management · Senior · Question 4 of 75
Where should the state of a list filter (search text, sort, page) ideally live in a routed app?
- ✓Correct answer: In the URL search params - shareable, survives reloads and works with back/forward
- 2In a global Redux store so every component can read it
- 3In
useRefso changes don't cause re-renders
Explanation
The URL is state too. Filters in ?q=&sort=&page= make links shareable and history meaningful, and loaders/query keys can derive from them. Debounce typing and replace (not push) history entries for every keystroke.