Not able to pass routePath to useNavigate in abstract hook #2707
Unanswered
micokontic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am new to tanstack router. I have this hook that i want to use to menage state of my search
`import {
getRouteApi,
RegisteredRouter,
RouteIds,
useNavigate,
} from '@tanstack/react-router'
export function useFilters<T extends RouteIds<RegisteredRouter['routeTree']>>(
routeId: T,
) {
const routeApi = getRouteApi<RegisteredRouter, T>(routeId)
const navigate = useNavigate({ from: '/leads' })
}
but i instead of leads i want to use routeId/routePath but when i pass routeId i get error
Type 'T' is not assignable to type 'FromPathOption<Router<RootRoute<undefined, { queryClient: QueryClient; }, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, Record<...>, Record<...>>, T> | undefined'.Type '"root" | "/" | "/leads" | "/lead/$leadId" | "/_layout"' is not assignable to type 'FromPathOption<Router<RootRoute<undefined, { queryClient: QueryClient; }, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, Record<...>, Record<...>>, T> | undefined'.
Type '"root"' is not assignable to type 'FromPathOption<Router<RootRoute<undefined, { queryClient: QueryClient; }, AnyContext, AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>, TrailingSlashOption, Record<...>, Record<...>>, T> | undefined'.` Can someone help me to make this work?
Beta Was this translation helpful? Give feedback.
All reactions