add JSX components v2
This commit is contained in:
parent
b5dd0ed413
commit
4b1227149f
25 changed files with 1080 additions and 3 deletions
11
components-jsx/runtime.ts
Normal file
11
components-jsx/runtime.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
export const Fragment = Symbol("ComponentsJsx.Fragment");
|
||||
|
||||
export function createElement(type: typeof Fragment | ((props: any) => any), props: any, ...children: any[]) {
|
||||
if (type === Fragment) {
|
||||
return children;
|
||||
}
|
||||
|
||||
props ??= {};
|
||||
props.children = children;
|
||||
return type(props);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue