Primitives

usePreloadRoute

Edit this page

usePreloadRoute returns a function that can be used to preload a route manually.

const preload = usePreloadRoute();
preload(`/users/settings`, { preloadData: true });

Usage

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.


Type Signature

Parameters

ParameterTypeRequiredDescription
toToYesThe route path to preload
optionsobjectNoConfiguration options for preloading

Options

OptionTypeDefaultDescription
preloadDatabooleanfalseWhether to preload the route's data in addition to the route itself
Report an issue with this page