use-onclickoutside-hooks
v1.0.7
Published
# Installing
Downloads
1
Readme
Use Onclickoutside hooks
Installing
Using npm
$ npm install use-onclickoutside-hooks
import useOnClickOutside from 'use-onclickoutside-hooks'
Using yarn
$ yarn add use-onclickoutside-hooks
import useOnClickOutside from 'use-onclickoutside-hooks'
Example
import React, { useRef } from 'react';
import { useOnClickOutside } from 'use-onclickoutside-hooks';
export default function ComponentTest({ items = [] }) {
const ref = useRef();
useOnClickOutside(ref, () => {
... use function
});
return (
<div className="d-flex flex-row" ref={ref}>
contet
</div>
);
}