SolidJSS
SolidJSโ€ข14mo agoโ€ข
3 replies
notherpleb

When does load and preload run?

I started a solidstart project I'm toying with and I'm not understanding some of the data fetching model.
export const route = {
  load: async () => {
    console.log("load!");
  },
  preload: async () => {
    console.log("preload!");
  },
} satisfies RouteDefinition;

Is there any point combining the two? Because I only see "load" when I comment out the preload function. But either way, when I hover the link it still preloads but calls the load function.

When and for what should I use them?
Was this page helpful?