This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MutableRefObject, useEffect,useState } from 'react'; | |
// Define the type for the hook, which takes two arguments: a reference to a component and a callback function | |
type OutsideNotifierHook = ( | |
ref: MutableRefObject<any>, // The reference to the component | |
onOutsideClick: (isInside: false) => void // The callback function that will be triggered when a click outside of the component is detected | |
) => void; | |
// The implementation of the hook, which will be exported for use in other components |