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.
2 parents c25d28e + ec2628e commit 52ee2d4Copy full SHA for 52ee2d4
src/useDataApiHook-example/index.js
@@ -63,16 +63,12 @@ const useDataApi = (initialUrl, initialData) => {
63
};
64
}, [url]);
65
66
- const doFetch = url => {
67
- setUrl(url);
68
- };
69
-
70
- return { ...state, doFetch };
+ return [state, setUrl];
71
72
73
function App() {
74
const [query, setQuery] = useState('redux');
75
- const { data, isLoading, isError, doFetch } = useDataApi(
+ const [{data, isLoading, isError}, doFetch] = useDataApi(
76
'http://hn.algolia.com/api/v1/search?query=redux',
77
{ hits: [] },
78
);
0 commit comments