diff --git a/src/utils/createElement.js b/src/utils/createElement.js index aa96e49..0bf4ab5 100644 --- a/src/utils/createElement.js +++ b/src/utils/createElement.js @@ -1,9 +1,11 @@ function createElement(type, props, ...children) { + let _children = children; + if (children.some((child) => Array.isArray(child))) { - children = children.flat(); + _children = children.flat(); } - if (typeof type === 'function') { + if (typeof type === "function") { return type({ children, ...props }); } @@ -11,7 +13,7 @@ function createElement(type, props, ...children) { type, props: { ...props, - children: children, + children: _children, }, }; }