Allow to ignore initialParams when using useSearchParams #382
mauricedoepke
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you call the app via a link, e.g.
myapp://items/1234
while you defined these routes:
The itemId property will be set as an initialParam in react navigation. This means even if you navigate to
/items
which might be a list of items,useSearchParams
will still return1234
as itemId.When you navigate to a another item, the initial param will be propperly shadowed by the correct id, but once you navigate back to the list page
useSearchParams
will again return1234
as itemId.This is problematic if some components of your app rely on
itemId
being undefined if no specific item is displayed.I think it would be nice to have some option like useSearchParams({ignoreInitialParams: true) to deal with this case.
Beta Was this translation helpful? Give feedback.
All reactions