TanStackT
TanStack17mo ago
26 replies
full-green

Deeply passing down context

I have a React hook which provides a wrapper around fetch which automatically retrieves an access token via another hook. Within previous custom useQuery() hooks, I could just use that hook, since everything was React hooks.

Now within TanStack Router, I don't have that option anymore. I know that I can pass the hook result through context and then pass the wrapped fetch function through to *QueryOptions() methods, but that seems extremely repetitive.

Is there a better make the result of my original hook available to all my fetch*() functions without having to pass it down in every single place?
Was this page helpful?