diff --git a/packages/compose/README.md b/packages/compose/README.md index 2ec0419ea2501b..ce98b5e6314612 100644 --- a/packages/compose/README.md +++ b/packages/compose/README.md @@ -399,7 +399,7 @@ _Parameters_ _Returns_ -- `import('react').RefCallback`: Ref callback. +- `import('react').RefCallback`: Ref callback. # **useResizeObserver** diff --git a/packages/compose/src/hooks/use-ref-effect/index.js b/packages/compose/src/hooks/use-ref-effect/index.js index 6118b1fb14518d..3ad97d9990ebbe 100644 --- a/packages/compose/src/hooks/use-ref-effect/index.js +++ b/packages/compose/src/hooks/use-ref-effect/index.js @@ -20,12 +20,12 @@ import { useCallback, useRef } from '@wordpress/element'; * @param {(node: Node) => (() => void) | undefined} callback Callback with ref as argument. * @param {import('react').DependencyList} dependencies Dependencies of the callback. * - * @return {import('react').RefCallback} Ref callback. + * @return {import('react').RefCallback} Ref callback. */ export default function useRefEffect( callback, dependencies ) { /** @type {import('react').MutableRefObject<(() => void) | undefined>} */ const cleanup = useRef(); - return useCallback( ( /** @type {Node} */ node ) => { + return useCallback( ( /** @type {Node | null} */ node ) => { if ( node ) { cleanup.current = callback( node ); } else if ( cleanup.current ) {