feishin/src/renderer/hooks/use-is-mounted.ts

12 lines
214 B
TypeScript
Raw Normal View History

2022-12-19 15:59:14 -08:00
import { useEffect, useState } from 'react';
export const useIsMounted = () => {
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
return isMounted;
};