How would you develop a useIsMounted() hook in React to indicate a component's mount status?

Free for the first 3 answer contributors

Interview question asked to Frontend Engineers interviewing at DocuSign, Indeed.com, Booking.com and others: How would you develop a useIsMounted() hook in React to indicate a component's mount status?.