piral-react
Version:
Plugin for integrating React 16+ components in Piral.
20 lines (19 loc) • 784 B
TypeScript
import { ComponentType } from 'react';
import { createConverter } from './lib/converter';
export interface HtmlComponent<TProps> {
component: {
mount(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
update?(element: HTMLElement, props: TProps, ctx: any, locals: any): void;
unmount?(element: HTMLElement, locals: any): void;
};
type: 'html';
}
export interface ReactConverter {
(...params: Parameters<ReturnType<typeof createConverter>>): HtmlComponent<any> | ComponentType<any>;
}
export declare function createReactConverter(...params: Parameters<typeof createConverter>): {
from: ReactConverter;
Extension: any;
};
declare const fromReact: ReactConverter, ReactExtension: any;
export { fromReact, ReactExtension };