Function useMounted

A custom React hook that determines whether the component is mounted.

const isMounted = useMounted();
console.log(isMounted); // true if the component is mounted
  • Returns boolean

    • Returns true if the component is mounted, false otherwise.