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
|
Line | |
---|
1 | import { useCallback, useEffect, useState } from 'react';
|
---|
2 | var 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 | };
|
---|
14 | export default useError;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.