Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7228257

Browse files
committed
last changes
1 parent 33d0009 commit 7228257

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎src/useDataApiHook-example/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import React, {
66
} from 'react';
77
import axios from 'axios';
88

9-
function dataFetchReducer(state, action) {
9+
const dataFetchReducer=(state, action)=> {
1010
switch (action.type) {
1111
case 'FETCH_INIT':
1212
return { ...state, isLoading: true, isError: false };
@@ -22,12 +22,11 @@ function dataFetchReducer(state, action) {
2222
...state,
2323
isLoading: false,
2424
isError: true,
25-
data: { hits: [] },
2625
};
2726
default:
2827
throw new Error();
2928
}
30-
}
29+
};
3130

3231
const useDataApi = (initialUrl, initialData) => {
3332
const [url, setUrl] = useState(initialUrl);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /