atechhub-use-mounted
Version:
A React hook to track component mounted state
12 lines (11 loc) • 371 B
TypeScript
import { RefObject } from "react";
/**
* useMounted is a custom hook that tracks the mounted state of a component.
* It returns a ref object with a boolean value indicating whether the component is mounted.
*
* @returns {Object} An object containing the mounted ref
*/
declare const useMounted: () => {
mounted: RefObject<boolean>;
};
export default useMounted;