T
TanStack2y ago
foreign-sapphire

Incorrect Context Type

Hey folks, I'm trying to recreate the React Authenticated Route example from: https://github.com/tanstack/router/tree/main/examples/react/authenticated-routes-context However, I keep getting a type error: Property 'auth' does not exist on context {} any ideas how to fix this?
GitHub
router/examples/react/authenticated-routes-context at main · TanSta...
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router
No description
No description
5 Replies
flat-fuchsia
flat-fuchsia2y ago
You need to make sure the ReturnType of the useKindeAuth hook is registered on the rootRoute using the createRootRouteWithContext function.
foreign-sapphire
foreign-sapphireOP2y ago
how does that work with the autogen file router? Oh, just wrap the component in __root
flat-fuchsia
flat-fuchsia2y ago
Yes, src/routes/__root.tsx is not touched by TSR Cli.
flat-fuchsia
flat-fuchsia2y ago
GitHub
router/examples/react/authenticated-routes-context/src/routes/__roo...
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router
foreign-sapphire
foreign-sapphireOP2y ago
gotcha, makes sense. thanks!

Did you find this page helpful?