We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33d0009 commit 7228257Copy full SHA for 7228257
src/useDataApiHook-example/index.js
@@ -6,7 +6,7 @@ import React, {
6
} from 'react';
7
import axios from 'axios';
8
9
-function dataFetchReducer(state, action) {
+const dataFetchReducer = (state, action) => {
10
switch (action.type) {
11
case 'FETCH_INIT':
12
return { ...state, isLoading: true, isError: false };
@@ -22,12 +22,11 @@ function dataFetchReducer(state, action) {
22
...state,
23
isLoading: false,
24
isError: true,
25
- data: { hits: [] },
26
};
27
default:
28
throw new Error();
29
}
30
-}
+};
31
32
const useDataApi = (initialUrl, initialData) => {
33
const [url, setUrl] = useState(initialUrl);
0 commit comments