How to infer the type of Route component with the context of it?
Let's say I have this component:
I want to create a function that passes Route but I don't know how to infer the type of Route with the context in it (I have trpc, queryClient, session, and error).
I'm trying to create this component as a kind of pre process for ReturnReasonPage to check if the user has a permission.
2 Replies
xenial-blackOP•4w ago
I used
export type Route = typeof Route
but this feels like a dirty solution. Hoping there's a better one.
This is a dumb approach. I didn't realize I could just get the RouteContext anywhere with useRouterContext
no need to solve this.extended-salmon•4w ago
you can also use getRouteApi