Skip to content

Type Alias: ComponentFn<C, K>

API / @xmachines/play-react / ComponentFn

type ComponentFn<C, K> = (ctx) => ReactNode;

Defined in: @json-render/react

Component render function type for React

Type Parameters

Type Parameter
C extends Catalog
K extends keyof InferCatalogComponents<C>

Parameters

ParameterType
ctxComponentContext<C, K>

Returns

ReactNode

Example

const Button: ComponentFn<typeof catalog, 'Button'> = ({ props, emit }) => (
<button onClick={() => emit("press")}>{props.label}</button>
);