useMatches with breadcrumbs and search view
How can I keep the search: {view: "view2"} in useMatches() when I create breadcrumbs?
I create breadcrumbs by using loader: () => ({crumb: "test"})
But when I navigate to a new path, I am able to navigate back to where I came from, but the search param is gone.
1 Reply
quickest-silverOP•8mo ago
const matchesWithCrumbs = matches.filter((match) => isMatch(match, "loaderData.crumb"));
const breadcrumbs = matchesWithCrumbs.map(({ pathname, loaderData, search }) => {
return {
path: pathname,
label: loaderData?.crumb,
search,
};
});
loader: () => ({ crumb: t("navigation.profile") }),
But when I change the searchParam by e.g. a tab click within the current page, it is not stored in my crumbs