securityos/node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs

16 lines
376 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
import { useRef } from 'react';
import { useIsomorphicLayoutEffect } from './use-isomorphic-effect.mjs';
function useIsMounted() {
const isMounted = useRef(false);
useIsomorphicLayoutEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return isMounted;
}
export { useIsMounted };