17 lines
309 B
TypeScript
17 lines
309 B
TypeScript
|
|
import useBoolean from './use-boolean'
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Loading
|
||
|
|
*
|
||
|
|
* @param initValue Init value
|
||
|
|
*/
|
||
|
|
export default function useLoading(initValue = false) {
|
||
|
|
const { bool: loading, setTrue: startLoading, setFalse: endLoading } = useBoolean(initValue)
|
||
|
|
|
||
|
|
return {
|
||
|
|
loading,
|
||
|
|
startLoading,
|
||
|
|
endLoading,
|
||
|
|
}
|
||
|
|
}
|