diff --git a/.changeset/true-rabbits-greet.md b/.changeset/true-rabbits-greet.md new file mode 100644 index 0000000..02d3b5f --- /dev/null +++ b/.changeset/true-rabbits-greet.md @@ -0,0 +1,5 @@ +--- +'@clutch-creator/toolkit': patch +--- + +fix react 18 compatibility diff --git a/src/state/hooks.tsx b/src/state/hooks.tsx index 06178e0..d064345 100644 --- a/src/state/hooks.tsx +++ b/src/state/hooks.tsx @@ -1,14 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-function-type */ 'use client'; -import { - use, - useCallback, - useContext, - useEffect, - useMemo, - useRef, -} from 'react'; +import { useCallback, useContext, useEffect, useMemo, useRef } from 'react'; import { cloneChildren, shallowEqual } from '../utils/helpers.js'; import { useEvent } from '../utils/hooks.js'; import { @@ -235,20 +228,6 @@ export const useEventsInstance = ( [key: string]: unknown; } ) => { - let resolvedChildren: React.ReactNode = children; - - // Resolve React.lazy children until React support cloneChildren with them - if ( - children && - typeof children === 'object' && - '$$typeof' in children && - children.$$typeof === Symbol.for('react.lazy') - ) { - resolvedChildren = use( - (children as unknown as { _payload: Promise })._payload - ); - } - const parentScopeSelection = useScopeSelection(); const scopeSelection: TScopeSelection = useMemo(() => { return { @@ -324,7 +303,7 @@ export const useEventsInstance = ( }; const render = (events: Record) => { - let res = cloneChildren(resolvedChildren, { + let res = cloneChildren(children, { ...extraProps, ...props, ...events,