From 79b817a3198c0072bc9faad273b09d7e9c894a8e Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Thu, 21 Oct 2021 11:31:09 -0700 Subject: [PATCH] fix(jsx): jsx and React.createElement compat function --- src/jsx.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/jsx.ts b/src/jsx.ts index 06953a7c6a..673653581d 100644 --- a/src/jsx.ts +++ b/src/jsx.ts @@ -83,7 +83,12 @@ const normalize = (jsxVNode: JSXVNode): VNode | VNode[] | undefined => { } }; -const jsx = (tag: string | FC, props?: VProps, ...children: JSXVNode[]): VNode => { +const jsx = ( + tag: string | FC, + props?: VProps, + key?: string | null, + ...children: JSXVNode[] +): VNode => { let delta: VDelta | undefined; if (props) { const rawDelta = (props.delta); @@ -95,6 +100,7 @@ const jsx = (tag: string | FC, props?: VProps, ...children: JSXVNode[]): VNode = children = (props.children); delete props.children; } + if (key) props.key = key; } if (typeof tag === 'function') { return tag(props, children, delta);