lazySurface

Returns a surface that loads its code the first time it is drawn or preloaded.

@internote/canvas-sdk/reactFunction
On this page
import { lazySurface } from '@internote/canvas-sdk/react';

The load runs once. A load that fails is the surface's failure, said in place by the host as any surface that throws is; asked again, it tries again.

#Signature

(load: () => Promise<SurfaceModule>): LazySurface

#Parameters

load
Loads the surface: a dynamic import, resolving to the component or its module.

#Example

export const codeEnvironment = defineEnvironment({
    name: 'code',
    Surface: lazySurface(() => import('./surface/Surface').then((m) => m.CodeSurface)),
});

Declared in packages/canvas-sdk/src/react/lazy-surface.ts:42.

Last updated