You're missing the point, axios is almost the same as fetch API and it don't remove those .then() methods. You're using async/await syntax and this is what removes .then(). This have nothing to do with the library. I also think that the library is obsolete after browsers added fetch function. You're adding whole library that do exactly the same what native API do.
Axios is not using async/await. Your code do that and it's JavaScript, the same is with native fetch. async/await is syntax sugar for promises that is not part of Axios it's part of JavaScript. Axios is just using promises it don't uses async/await. So the same will be with any library that use promises.
Here is example of native fetch API:
varres=awaitfetch('url');vardata=awaitres.json();
see you also don't need to use .then(), this have nothing to do with axios.
You're missing the point, axios is almost the same as fetch API and it don't remove those
.then()
methods. You're using async/await syntax and this is what removes.then()
. This have nothing to do with the library. I also think that the library is obsolete after browsers added fetch function. You're adding whole library that do exactly the same what native API do.Hi thanks for the comment and I my haven't explained well, but what I mean't is that you don't have to code the
.then()
Axios is not using async/await. Your code do that and it's JavaScript, the same is with native fetch. async/await is syntax sugar for promises that is not part of Axios it's part of JavaScript. Axios is just using promises it don't uses async/await. So the same will be with any library that use promises.
Here is example of native fetch API:
see you also don't need to use
.then()
, this have nothing to do with axios.I see, I appreciate your explanation on the topic!