Grokking React Native
0% completed
Fetching Data with Axios
The same 404 response takes two different paths in fetch and in Axios. With fetch, the Promise resolves and you must check response.ok yourself. With Axios, the Promise rejects, so the failure goes directly to your catch block. Axios is a third-party HTTP client, and small differences like this one are the main reason people choose it.
Neither one is simply better. fetch is built in and adds nothing to your app, while Axios is one more dependency to install and keep updated. In return, you write less repeated code, and you get a few features that fetch lacks
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%