Fetch vs Axios
January 2, 2024
Fetch vs Axios
Fetch
- Built-in im Browser
- Response Errors muessen manuell geprueft werden (
res.ok) - Kein Timeout ohne extra Code
- Streams und
ResponseAPIs sind flexibel
Axios
- Extra Library
- JSON wird automatisch geparst
- Interceptors fuer Auth/Logging
- Timeout und Cancel Tokens eingebaut
- Gute TypeScript Types
Fazit
- Kleine Apps:
fetchreicht - Groessere Apps mit Auth/Logging: Axios komfortabler