lazy
Edit this pageimport { lazy } from "solid-js"import type { Component } from "solid-js"
function lazy<T extends Component<any>>( fn: () => Promise<{ default: T }>): T & { preload: () => Promise<T> }
Used to lazy load components to allow for code splitting.
Components are not loaded until rendered.
Lazy loaded components can be used the same as its statically imported counterpart, receiving props etc.
Lazy components trigger <Suspense>
// wrap importconst ComponentA = lazy(() => import("./ComponentA"));
// use in JSX<ComponentA title={props.title} />