Notice how we didn't have to manually convert the response manually to JSON. It's because axios does that automatically for us. This is just one of the features. So yeah, it saves us some time and lines of code.
Another bio section this feels like tinder all over again.. I like puppies, cold jaeger and going to a therapist, on a daily basis I try to keep up with all the younglings in the JS world
You used then for one example and async/await for the other. It's better if you want to show a like for like comparison that you stick to the same approach so that you can highlight just the differences between then two. This makes fetch seem more verbose and more difficult to read when most of that is due to await being more concise.
Mostly because it is simpler to work with. Here's an example considering that I want to fetch from todos from a sample API:
With fetch:
With axios:
Notice how we didn't have to manually convert the response manually to JSON. It's because axios does that automatically for us. This is just one of the features. So yeah, it saves us some time and lines of code.
well it's not exactly the same, axios comes with backwards compatibility, and polyfills in old browsers, it will work almost everywhere
You used then for one example and async/await for the other. It's better if you want to show a like for like comparison that you stick to the same approach so that you can highlight just the differences between then two. This makes fetch seem more verbose and more difficult to read when most of that is due to await being more concise.
You're right. Edited the example to use async-await in both cases. Thanks for notifying.