@tremendous/help
    Preparing search index...

    Function useMounted

    • Custom hook to check if a component is mounted.

      This hook returns a boolean indicating whether the component is currently mounted.

      Returns boolean

      • Returns true if the component is mounted, false otherwise.
      function MyComponent() {
      const isMounted = useMounted();

      useEffect(() => {
      if (isMounted) {
      console.log('Component is mounted');
      }
      return () => {
      console.log('Component will unmount');
      };
      }, [isMounted]);

      return <div>Check the console for mount status</div>;
      }