You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to update just the page portion of the query. However, this doesn't work: it removes all the query params and sets just the the page portion. (not sure if this is a bug or an intended behavior)
IMHO the bigger undocumented caveat is that any mutation of searchParams (the first array entry returned), e.g. searchParams.delete('page') has the side effect of actually changing the URL.
Yeah, both are relevant: the Object.fromEntries trick would be helpful there, and then an explanation of how to properly delete a param would be also useful. Is
Describe what's incorrect/missing in the documentation
Looking at https://reactrouter.com/en/main/hooks/use-search-params, one may think that to update one param while keeping the others, one can do:
to update just the
page
portion of the query. However, this doesn't work: it removes all the query params and sets just the thepage
portion. (not sure if this is a bug or an intended behavior)To work around this, one has to do:
I think this is not trivial, and hence should be documented (unless it's a bug, I'm using 6.22.3).
The text was updated successfully, but these errors were encountered: