Fetch API in React — a practical guide to React Fetch API with clear examples you can reuse in real projects.
React Tutorial Series (50/103). Prefer one article? Read the complete React tutorial.
Short description
Check res.ok; parse JSON; handle aborts with AbortController.
Fetch in effect
useEffect(() => {
const ctrl = new AbortController();
fetch('/api/items', { signal: ctrl.signal })
.then((r) => r.json())
.then(setItems)
.catch(setError);
return () => ctrl.abort();
}, []);