File "useIsMounted.js"
Full Path: /home/buyiwexj/public_html/wp-content/plugins/extendify/src/Library/hooks/useIsMounted.js
File size: 480 bytes
MIME-type: text/x-java
Charset: utf-8
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;
};