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 a62458b

Browse files
committed
naming
1 parent 9fe3149 commit a62458b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎src/index.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react';
22
import 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

99
import * as serviceWorker from './serviceWorker';
1010

‎src/useDataApiHook-example/index.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

3636
function 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
)

0 commit comments

Comments
(0)

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