app/hooks/useIsMounted.js
/**
 * Hook to check if component is still mounted
 *
 * @returns {boolean} true if the component is mounted, false otherwise
 */
Hook to check if component is still mounted
@returns {boolean} true if the component is mounted, false otherwise
Hook to check if component is still mounted @returns { boolean } true if the component is mounted false otherwise
function useIsMounted() {
  const isMounted = React.useRef(false);
  React.useEffect(() => {
    isMounted.current = true;
    return () => {
      isMounted.current = false;
    };
  }, []);
  return React.useCallback(() => isMounted.current, []);
}
function useIsMounted ( ) { const isMounted = React . useRef ( false ) ; React . useEffect ( ( ) => { isMounted . current = true ; return ( ) => { isMounted . current = false ; } ; } , [ ] ) ; return React . useCallback ( ( ) => isMounted . current , [ ] ) ; }
Hook to check if component is still mounted
 @returns {boolean} true if the component is mounted, false otherwise
Hook to check if component is still mounted @returns { boolean } true if the component is mounted false otherwise