File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import React from 'react';
2
2
import ReactDOM from 'react-dom' ;
3
3
4
4
// import App from './useState-example';
5
- import App from './useEffect-example' ;
5
+ // import App from './useEffect-example';
6
6
// import App from './customHook-example';
7
- // import App from './useDataApiHook-example';
7
+ import App from './useDataApiHook-example' ;
8
8
9
9
import * as serviceWorker from './serviceWorker' ;
10
10
Original file line number Diff line number Diff line change @@ -25,18 +25,18 @@ const useDataApi = (initialUrl, initialData) => {
25
25
[ url ] ,
26
26
) ;
27
27
28
- const getRequest = ( event , url ) => {
28
+ const doGet = ( event , url ) => {
29
29
setUrl ( url ) ;
30
30
event . preventDefault ( ) ;
31
31
} ;
32
32
33
- return { data, isLoading, isError, getRequest } ;
33
+ return { data, isLoading, isError, doGet } ;
34
34
} ;
35
35
36
36
function App ( ) {
37
37
const [ query , setQuery ] = useState ( 'redux' ) ;
38
38
39
- const { data, isLoading, isError, getRequest } = useDataApi (
39
+ const { data, isLoading, isError, doGet } = useDataApi (
40
40
'http://hn.algolia.com/api/v1/search?query=redux' ,
41
41
{ hits : [ ] } ,
42
42
) ;
@@ -45,7 +45,7 @@ function App() {
45
45
< Fragment >
46
46
< form
47
47
onSubmit = { event =>
48
- getRequest (
48
+ doGet (
49
49
event ,
50
50
`http://hn.algolia.com/api/v1/search?query=${ query } ` ,
51
51
)
You can’t perform that action at this time.
0 commit comments