Coding

How would you create a useClickOutside() hook in React to detect external clicks?

Did you come across this question in an interview?

Interview question asked to Frontend Engineers interviewing at Huawei, Crytek, GREE and others: How would you create a useClickOutside() hook in React to detect external clicks?.