createLoadFactory() function
Home > @rimitive/view > createLoadFactory
createLoadFactory() function
Section titled “createLoadFactory() function”Create a load factory with the given dependencies.
Signature:
export declare function createLoadFactory({ signal }: LoadOpts): LoadFactory;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
{ signal } |
Returns:
Example
Section titled “Example”import { createLoadFactory } from '@rimitive/view/load';
const load = createLoadFactory({ signal });
const asyncContent = load( () => fetchData(), (state) => match(state.status, (status) => status === 'ready' ? Content(state.data()!) : Loading() ));