4
0
forked from crowetic/commerce

Adding Click Outside

This commit is contained in:
Belen Curcio 2020-12-02 13:17:30 -03:00
parent 6020d5cfd2
commit 3f5045d3a8

View File

@ -11,11 +11,9 @@ const ClickOutside = (
{ active = true, onClick, children }: ClickOutsideProps,
ref: Ref<HTMLDivElement> | null | any = {}
) => {
console.log('--------', active, '-----------')
const innerRef = ref?.current
const handleClick = (event: any) => {
console.log(innerRef, event.target)
if (!hasParent(event.target, innerRef)) {
if (typeof onClick === 'function') {
event.preventDefault()