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 |