source: imaps-frontend/node_modules/react-use/esm/useError.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 392 bytes
RevLine 
[d565449]1import { useCallback, useEffect, useState } from 'react';
2var useError = function () {
3 var _a = useState(null), error = _a[0], setError = _a[1];
4 useEffect(function () {
5 if (error) {
6 throw error;
7 }
8 }, [error]);
9 var dispatchError = useCallback(function (err) {
10 setError(err);
11 }, []);
12 return dispatchError;
13};
14export default useError;
Note: See TracBrowser for help on using the repository browser.