1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 06:45:23 -04:00
jarv.is/hooks/useFirstMountState.ts
2022-07-25 13:11:40 -04:00

16 lines
272 B
TypeScript

import { useRef } from "react";
const useFirstMountState = (): boolean => {
const isFirstMount = useRef(true);
if (isFirstMount.current) {
isFirstMount.current = false;
return true;
}
return isFirstMount.current;
};
export default useFirstMountState;