use-mounted.ts 219 B

12345678910111213
  1. import React from 'react';
  2. const useMounted = () => {
  3. const [mounted, setMounted] = React.useState(false);
  4. React.useEffect(() => {
  5. setMounted(true);
  6. }, []);
  7. return mounted;
  8. };
  9. export default useMounted;