From f01d16f2c3503ed7e2c18441d13f060a38c9cd26 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Fri, 26 Apr 2024 13:08:48 +0200 Subject: [PATCH] Avoid importing React --- src/diagramElements/Section.tsx | 6 +++--- src/diagramElements/Subsection.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/diagramElements/Section.tsx b/src/diagramElements/Section.tsx index 6422ce8..b852bf1 100644 --- a/src/diagramElements/Section.tsx +++ b/src/diagramElements/Section.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { Children, cloneElement } from 'react'; import clsx from 'clsx'; import T from '@wojtekmaj/react-t'; @@ -25,8 +25,8 @@ export default function Section(props: SectionProps) { function renderChildren() { // If we're creating a section containing subsections, we don't need to create one. if (children.find((el) => el.type === Subsection)) { - return React.Children.map(children, (child) => - React.cloneElement(child, Object.assign({ sectionCol: col }, props, child.props)), + return Children.map(children, (child) => + cloneElement(child, Object.assign({ sectionCol: col }, props, child.props)), ); } diff --git a/src/diagramElements/Subsection.tsx b/src/diagramElements/Subsection.tsx index 96deb72..50c1345 100644 --- a/src/diagramElements/Subsection.tsx +++ b/src/diagramElements/Subsection.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { Children, cloneElement } from 'react'; import { methods } from './Section.module.css'; @@ -65,8 +65,8 @@ type SubsectionProps = { }; export default function Subsection({ children, col, colspan, sectionCol }: SubsectionProps) { - const mappedChildren = React.Children.map(children, (child) => - React.cloneElement( + const mappedChildren = Children.map(children, (child) => + cloneElement( child, Object.assign( { col },