Click above header menu on this page, you can see that the dropdown menu is dismissed after clicking outside.
Now you are asked to implement a React hook to make it eaiser to implement such behavior.
function Component() {
const ref = useClickOutside(() => {
alert('clicked outside')
});
return <div ref={ref}>..</div>
}
Solution
No solution file is included for this exercise yet.
Use the problem as an open implementation prompt, then compare your reasoning with the linked React documentation.