chore(wrapper): cleanup
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
import { FC, PropsWithChildren, useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
|
import type { FC, PropsWithChildren } from 'react';
|
||||||
|
|
||||||
import StoreContext from '../../contexts/RFStoreContext';
|
import StoreContext from '../../contexts/RFStoreContext';
|
||||||
import ReactFlowProvider from '../../components/ReactFlowProvider';
|
import ReactFlowProvider from '../../components/ReactFlowProvider';
|
||||||
|
|
||||||
const Wrapper: FC<PropsWithChildren> = ({ children }) => {
|
const Wrapper: FC<PropsWithChildren> = ({ children }) => {
|
||||||
if (useContext(StoreContext)) {
|
const isWrapped = useContext(StoreContext);
|
||||||
|
|
||||||
|
if (isWrapped) {
|
||||||
// we need to wrap it with a fragment because it's not allowed for children to be a ReactNode
|
// we need to wrap it with a fragment because it's not allowed for children to be a ReactNode
|
||||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
|
||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
|
|||||||
Reference in New Issue
Block a user