Implement a custom hook useClickOutside to handle the click outside of the passed ref element. The hook takes a callback function which will be invoked when the user clicks outside of the passed ref element.
const ref = useRef(null);
useClickOutside(ref, () => {
console.log("clicked outside");
});
⚙️
Booting up the editor...
Please wait while we load the editor.
⚙️
Loading Preview...