think/packages/client/src/hooks/useMount.tsx

16 lines
249 B
TypeScript

import { useEffect, useState } from 'react';
export function useMount(): boolean {
const [value, setValue] = useState(false);
useEffect(() => {
setValue(true);
return () => {
setValue(false);
};
}, []);
return value;
}