Interface DittoLazyProviderProps

interface DittoLazyProviderProps {
    children?: RenderFunction;
    initOptions?: InitOptions;
    render?: RenderFunction;
    setup: ((appPath) => Promise<Ditto>);
}

Properties

children?: RenderFunction
initOptions?: InitOptions
setup: ((appPath) => Promise<Ditto>)

This function is called whenever a child component uses a Ditto instance through the useDitto hook and the instance needs to be created.

The returned instance is cached under appPath, so configure it with appPath as its persistence directory. That keeps the lazily loaded instance resolvable by the same path through useDitto and the query hooks.

Type declaration

    • (appPath): Promise<Ditto>
    • Parameters

      • appPath: string

        Path the instance is created for. Used both as a discriminator for how to create the instance and as its cache key.

      Returns Promise<Ditto>

Returns

A Ditto instance initialized on the given path, or null to skip creation.