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';
22import ReactDOM from 'react-dom' ;
33
44// import App from './useState-example';
5- import App from './useEffect-example' ;
5+ // import App from './useEffect-example';
66// import App from './customHook-example';
7- // import App from './useDataApiHook-example';
7+ import App from './useDataApiHook-example' ;
88
99import * as serviceWorker from './serviceWorker' ;
1010
Original file line number Diff line number Diff line change @@ -25,18 +25,18 @@ const useDataApi = (initialUrl, initialData) => {
2525 [ url ] ,
2626 ) ;
2727
28- const getRequest = ( event , url ) => {
28+ const doGet = ( event , url ) => {
2929 setUrl ( url ) ;
3030 event . preventDefault ( ) ;
3131 } ;
3232
33- return { data, isLoading, isError, getRequest } ;
33+ return { data, isLoading, isError, doGet } ;
3434} ;
3535
3636function App ( ) {
3737 const [ query , setQuery ] = useState ( 'redux' ) ;
3838
39- const { data, isLoading, isError, getRequest } = useDataApi (
39+ const { data, isLoading, isError, doGet } = useDataApi (
4040 'http://hn.algolia.com/api/v1/search?query=redux' ,
4141 { hits : [ ] } ,
4242 ) ;
@@ -45,7 +45,7 @@ function App() {
4545 < Fragment >
4646 < form
4747 onSubmit = { event =>
48- getRequest (
48+ doGet (
4949 event ,
5050 `http://hn.algolia.com/api/v1/search?query=${ query } ` ,
5151 )
You can’t perform that action at this time.
0 commit comments