[Begginer] How to preserve search params when navigating to child routes #2289
Unanswered
Trictonicmp
asked this question in
Q&A
Replies: 1 comment 2 replies
-
NVM, I realized taht I can pass search params to all child route, quite annoying but it works, It would be great to have something similar to "relativeTo" in Angular's router. const openAddShirt = () => {
router.navigate({
from: router.history.location.href,
to: addShirtFromSectionRoute.to,
search: (prev) => ({...prev}),
});
}; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, this may be a silly question with a simple answer but I haven't figured out yet so I ask for help here.
I have a route like this:
and within this route's component I have an outlet for a modal, that I use to display
shirtMainDetailsProxyRoute
oraddShirtFromSectionRoute
, but when I go to any of these routes, search params get cleared, I have tried different approaches like:and also tried with
but this last just broke the routing as it appends search params at the end.
this also makes it harder to go close the modal as it erases all of the params, making it harder to deal with a params state.
I hope I explained myself.
Beta Was this translation helpful? Give feedback.
All reactions