State Management · Middle · Question 72 of 75
Why update search params with { replace: true } while the user types a filter?
setSearchParams({ q: value }, { replace: true });- ✓Correct answer: To avoid adding a history entry per keystroke, so Back goes to the previous page
- 2To prevent the loader from running
- 3To reset other params
Explanation
Push a new entry only for meaningful navigations (e.g. submitting a search). Debouncing the update reduces loader calls too.