| title |
usePreloadRoute |
| use_cases |
performance optimization, manual preloading, predictive navigation, prefetching routes |
| tags |
preload |
performance |
optimization |
prefetch |
manual |
|
| version |
1.0 |
| description |
Manually preload routes with usePreloadRoute - optimize performance by prefetching route data before navigation in your SolidJS app. |
usePreloadRoute returns a function that can be used to preload a route manually.
const preload = usePreloadRoute();
preload(`/users/settings`, { preloadData: true });
Routes are preloaded by default within Solid Router contexts.
This helper is useful when you want to preload a route in response to some other event, such as a button click or a timer.
| Parameter |
Type |
Required |
Description |
to |
To |
Yes |
The route path to preload |
options |
object |
No |
Configuration options for preloading |
| Option |
Type |
Default |
Description |
preloadData |
boolean |
false |
Whether to preload the route's data in addition to the route itself |