Skip to content

Function: defineClientComponent()

ts
function defineClientComponent(
   loader, 
   args?, 
   cb?): DefineComponent<{
}, () => 
  | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>
  | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>[]
  | null, {
}, {
}, {
}, ComponentOptionsMixin, ComponentOptionsMixin, {
}, string, PublicProps, ToResolvedProps<{
}, {
}>, {
}, {
}, {
}, {
}, string, ComponentProvideOptions, true, {
}, any>;

Defined in: packages/valaxy/client/define/client-component.ts:14

Define a component that only renders on the client side.

Useful for wrapping browser-only third-party libraries that access window, document, or other browser APIs not available during SSR/SSG.

Parameters

loader

() => Promise< | Component | { default: Component; }>

Dynamic import function, e.g. () => import('some-lib')

args?

[Record<string, any>?, (Record<string, any> | () => any)?]

Optional tuple of [props, children] to pass to the component

cb?

(component) => void

Optional callback invoked with the resolved component module

Returns

DefineComponent<{ }, () => | VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNode<RendererNode, RendererElement, { [key: string]: any; }>[] | null, { }, { }, { }, ComponentOptionsMixin, ComponentOptionsMixin, { }, string, PublicProps, ToResolvedProps<{ }, { }>, { }, { }, { }, { }, string, ComponentProvideOptions, true, { }, any>