From a1e2271f32fdd61a0f45ab78cc3f4cc3a66fb28f Mon Sep 17 00:00:00 2001 From: Scott Schottler Date: Sat, 16 Nov 2019 14:04:13 -0500 Subject: [PATCH] fix flatten issue --- didact.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/didact.js b/didact.js index 62436f1..76b4491 100644 --- a/didact.js +++ b/didact.js @@ -3,11 +3,13 @@ function createElement(type, props, ...children) { type, props: { ...props, - children: children.map(child => - typeof child === "object" - ? child - : createTextElement(child) - ), + children: children + .flat() + .map(child => + typeof child === "object" + ? child + : createTextElement(child) + ), }, } }