DenReg/jsx-html/mod.ts

28 lines
646 B
TypeScript
Raw Normal View History

2020-10-14 00:56:11 +00:00
import { jsx, Fragment } from './jsx.ts';
import type {
ComponentFunctionType,
NodePropsType,
NullableChildType,
} from './types.ts';
export { ElementNode } from './node/ElementNode.ts';
export { ComponentNode } from './node/ComponentNode.ts';
export type {
jsx,
Fragment,
ComponentFunctionType,
NullableChildType,
NodePropsType,
};
export const React = {
Fragment,
createElement<P extends NodePropsType = NodePropsType>(
element: string | ComponentFunctionType,
props: P | null,
...children: NullableChildType[]
) {
return jsx(element, props, ...children);
},
};