# extendify/3.0.6/src/Library/hooks/useIsMounted.js

Extendify, version 3.0.6. 25 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.0.6/code/src/Library/hooks/useIsMounted.js
- Raw: https://pluginprobe.com/plugins/extendify/3.0.6/raw/src/Library/hooks/useIsMounted.js
- Modified: 2026-02-18T22:27:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.0.6/code/src/Library/hooks/useIsMounted.js#L10-L20`.

```javascript
import { useEffect, useLayoutEffect, useRef } from '@wordpress/element';

export const useIsMounted = () => {
	const isMounted = useRef(false);

	useEffect(() => {
		isMounted.current = true;
		return () => {
			isMounted.current = false;
		};
	});
	return isMounted;
};
export const useIsMountedLayout = () => {
	const isMounted = useRef(false);

	useLayoutEffect(() => {
		isMounted.current = true;
		return () => {
			isMounted.current = false;
		};
	});
	return isMounted;
};

```
