mirror of https://github.com/fantasticit/think.git
16 lines
249 B
TypeScript
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;
|
||
|
}
|