UNPKG

@kadconsulting/dry

Version:
16 lines 446 B
import { useState } from 'react'; const useAsyncState = () => { const [state, setState] = useState('idle'); const startLoading = () => { setState('loading'); }; const stopLoading = () => { setState('idle'); }; const handleError = () => { setState('error'); }; return [state, startLoading, stopLoading, handleError]; }; export default useAsyncState; //# sourceMappingURL=useAsyncState.js.map