You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lazy loaded components can be used the same as its statically imported counterpart, receiving props etc.
Lazy components trigger <Suspense>
Preloading data in Nested Lazy Components
Top-level lazy components will automatically be preloaded as well as their preload functions.
However, nested lazy components will not be preloaded automatically because they are not part of the route hierarchy.
To preload such components, you can use the preload method exposed on the lazy component.
import{lazy}from"solid-js"importtype{Component}from"solid-js"constNested=lazy(()=>import("./Nested"))constComponentWithPreload: Component=()=>{// preload Nested component when neededasyncfunctionhandlePreload(){awaitNested.preload()}return(<div><buttononClick={handlePreload}>Preload Nested Component</button><Nested/></div>)}