T
TanStack•3y ago
genetic-orange

How do I declare the type for the props of a Route component?

Specifically, I'm talking about the component passed to the Route constructor. I've looked at the RouteProps type but 14 generic type parameters tells me it's not meant for direct use. I can't just Pick<typeof routeInstance, 'useParams' | etc> as that's a circular reference. Additionally, I can't find a MakeRouteProps like MakeLinkPropsOptions.
4 Replies
generous-apricot
generous-apricot•3y ago
If I understood your question correctly, I've been using LinkPropsOptions
sensitive-blue
sensitive-blue•3y ago
Using routeInstance.useParams() etc. is probably the intended way by Tanner if you detach the component declaration from route initialization https://discord.com/channels/719702312431386674/1007702008448426065/1076219568000872570
genetic-orange
genetic-orangeOP•3y ago
I've googled, checked GitHub issues, discussions, pull requests, this channel, but somehow I haven't thought of searching the other channel...
sensitive-blue
sensitive-blue•3y ago
It's hard to keep up with everything 😄 I'm glad I could help!

Did you find this page helpful?