Skip to content

Commit

Permalink
Avoid importing React
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Apr 26, 2024
1 parent 6df0af5 commit f01d16f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/diagramElements/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { Children, cloneElement } from 'react';
import clsx from 'clsx';
import T from '@wojtekmaj/react-t';

Expand All @@ -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)),
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/diagramElements/Subsection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { Children, cloneElement } from 'react';

import { methods } from './Section.module.css';

Expand Down Expand Up @@ -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 },
Expand Down

0 comments on commit f01d16f

Please sign in to comment.