#[Start] How do I provide react context hooks?

2 messages · Page 1 of 1 (latest)

lethal oar
#

I am trying to follow this guide: https://tanstack.com/router/v1/docs/framework/react/guide/router-context#how-about-using-react-contexthooks

Unfortunately <RouterProvider router={router} context={{ networkStrength }} /> is not working for me since router.tsx does not provide the router directly. Instead it exposes a getRouter. Doing <RouterProvider router={getRouter()} context={{ queryClient }} /> throws an error.

Package versions:

    "@tanstack/react-query": "5.90.21",
    "@tanstack/react-router": "1.159.10",
    "@tanstack/react-start": "1.159.13",
    "@tanstack/router-plugin": "1.159.12",

TanStack Router's router context is a very powerful tool that can be used for dependency injection among many other things. Aptly named, the router context is passed through the router and down throug...

north grove
#

please ask in #1240861643462934568 next time. what do you want to provide via react context here?