MCPcopy Create free account
hub / github.com/Klerith/react-hooks / getFetch

Function getFetch

src/hooks/useFetch.js:13–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13 const getFetch = async () => {
14
15 setState({
16 ...state,
17 isLoading: true,
18 });
19
20 const resp = await fetch(url);
21 const data = await resp.json();
22
23 setState({
24 data,
25 isLoading: false,
26 hasError: null,
27 });
28 }
29
30
31 useEffect(() => {

Callers 1

useFetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected