Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.4 KB

File metadata and controls

44 lines (34 loc) · 1.4 KB
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 });

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

Parameter Type Required Description
to To Yes The route path to preload
options object No Configuration options for preloading

Options

Option Type Default Description
preloadData boolean false Whether to preload the route's data in addition to the route itself