From 9e6e24395b6c272906c7c998d215e5ef85da0ff0 Mon Sep 17 00:00:00 2001 From: Danny Wahl Date: Fri, 16 Feb 2024 16:52:33 -0700 Subject: [PATCH] array.prototype.map() => React.Children.Map() --- isp-site/src/components/mdtoui.jsx | 50 +++++++++++++++++------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/isp-site/src/components/mdtoui.jsx b/isp-site/src/components/mdtoui.jsx index e0dba532..3589368d 100644 --- a/isp-site/src/components/mdtoui.jsx +++ b/isp-site/src/components/mdtoui.jsx @@ -1,3 +1,5 @@ +import { Children } from "react"; + // Modules import { View, @@ -143,34 +145,38 @@ const mdtoui = { const { children, ...tableProps } = props; return ( - {children.map((node, i) => { - if (node.type === "thead") { - const { children, ...theadProps } = node.props; + {Children.map(children, (child) => { + const { children, ...tProps } = child.props; + if (child.type === "thead") { return ( - - - {children.props.children.map((node, i) => { - return ( - - ); - })} - + + {Children.map(children, (child) => { + const { children, ...thrProps } = child.props; + return ( + + {Children.map(children, (child) => { + return ( + + ); + })} + + ); + })} ); } - const { children, ...tbodyProps } = node.props; return ( - - {children.map((node, i) => { - const { children, ...trProps } = node.props; + + {Children.map(children, (child) => { + const { children, ...tbrProps } = child.props; return ( - - {children.map((node, i) => { - return ; + + {Children.map(children, (child) => { + return ; })} );