framer-motion
Version:
A simple and powerful JavaScript animation library
16 lines (13 loc) • 376 B
JavaScript
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 };