Skip to content

Commit

Permalink
add useImperativeHandle explanation comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kacper-mikolajczak committed Sep 29, 2023
1 parent d1c0a27 commit a9601db
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/Hoverable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit a9601db

Please sign in to comment.