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 7228257 commit d4886e9Copy full SHA for d4886e9
src/useDataApiHook-example/index.js
@@ -63,30 +63,30 @@ const useDataApi = (initialUrl, initialData) => {
63
};
64
}, [url]);
65
66
- const doGet = (event,url) => {
+ const doFetch = url => {
67
setUrl(url);
68
- event.preventDefault();
69
70
71
- return { ...state, doGet };
+ return { ...state, doFetch };
72
73
74
function App() {
75
const [query, setQuery] = useState('redux');
76
- const { data, isLoading, isError, doGet } = useDataApi(
+ const { data, isLoading, isError, doFetch } = useDataApi(
77
'http://hn.algolia.com/api/v1/search?query=redux',
78
{ hits: [] },
79
);
80
81
return (
82
<Fragment>
83
<form
84
- onSubmit={event =>
85
- doGet(
86
- event,
+ onSubmit={event => {
+ doFetch(
87
`http://hn.algolia.com/api/v1/search?query=${query}`,
88
- )
89
- }
+ );
+
+ event.preventDefault();
+ }}
90
>
91
<input
92
type="text"
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments