useMountedState()
ts
function useMountedState(): boolean;Defined in: mounted.ts:21
React hook for checking if the component is mounted.
Returns
boolean
A state which is true if the component is mounted, false otherwise.
Example
tsx
function MyComponent () {
const isMounted = useMountedState();
return isMounted && <p>The component is mounted.</p>;
}Since
1.0.0
Author
Simon Kovtyk