SolidJSS
SolidJSβ€’9mo agoβ€’
9 replies
tronis

Preloading route data with context access

I want to preload data for a Home route nested within an authenticated web app. I am doing this by passing a preload function like so:

<Route path="/app/home" component={Home} preload={preloadHome} />


However, in my preloadHome function I need to access some values from a context provider, like for example an auth API key. But the preloadHome function can't access any context providers that I have since they aren't in the rendering context.

What should I do in this situation?
Was this page helpful?