From a9601db495e6d2904cd047ee58c6a140e30d87a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Miko=C5=82ajczak?= Date: Fri, 29 Sep 2023 11:19:11 +0200 Subject: [PATCH] add useImperativeHandle explanation comment --- src/components/Hoverable/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Hoverable/index.js b/src/components/Hoverable/index.js index eff165870048..f39c44b278ae 100644 --- a/src/components/Hoverable/index.js +++ b/src/components/Hoverable/index.js @@ -119,6 +119,7 @@ function InnerHoverable({disabled, onHoverIn, onHoverOut, children, shouldHandle } }, [disabled, isHovered, onHoverIn, onHoverOut]); + // Expose inner ref to parent through outerRef. This enable us to use ref both in parent and child. useImperativeHandle(outerRef, () => ref.current, []); const child = useMemo(() => React.Children.only(mapChildren(children, isHovered)), [children, isHovered]);