UNPKG

@dependable/tsx

Version:

Construct @dependable/view vdom using TypeScript TSX

19 lines (18 loc) 582 B
export const jsx = (type, props) => { const { children, ...propsWithoutChildren } = props; return { type, props: propsWithoutChildren, children: [children] }; }; export const jsxDEV = jsx; export const jsxs = (type, props) => { const { children, ...propsWithoutChildren } = props; return { type, props: propsWithoutChildren, children: children.flat() }; }; export const jsxsDEV = jsxs; export class Fragment { render(props) { if (Array.isArray(props.children)) { return props.children.flat(); } return props.children; } }