4
0
forked from crowetic/commerce

forwardRef

This commit is contained in:
Belen Curcio 2020-12-02 13:24:25 -03:00
parent 95897aa1c5
commit 3770ad7ea8

View File

@ -7,10 +7,11 @@ interface ClickOutsideProps {
children: any
}
const ClickOutside = (
const ClickOutside = forwardRef(
(
{ active = true, onClick, children }: ClickOutsideProps,
ref: Ref<HTMLDivElement> | null | any = {}
) => {
) => {
const innerRef = ref?.current
const handleClick = (event: any) => {
@ -38,6 +39,7 @@ const ClickOutside = (
})
return React.cloneElement(children, { ref })
}
}
)
export default forwardRef(ClickOutside)
export default ClickOutside