tronis
tronis
SSolidJS
Created by tronis on 4/12/2025 in #support
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} />
<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?
10 replies