Skip to content

How to access params IF app is at the route outside of Outlet? #955

Discussion options

You must be logged in to vote

I answered the question myself, but I will leave the answer below:

In my navigation bar, I now do the following:

const router = useRouter()
....
<SearchBar defaultValue={router.state.location.search.searchQuery ?? ''} />

The "router.state.location.search" will be a partial type of all of the different route's params combined; pretty nice 👍

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@schiller-manuel
Comment options

@danieljmann96
Comment options

Answer selected by danieljmann96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants