import { useEffect } from 'react';
const useClickOutside = (ref, fnCallback) => {
    function handleClickOutside(event) {
        if (ref && event.target && !ref.contains(event.target)) {
            fnCallback(event);
        }
    }
    useEffect(() => {
        document.addEventListener('click', handleClickOutside);
        return () => {
            document.removeEventListener('click', handleClickOutside);
        };
    });
};
export default useClickOutside;
