DEV Community

Discussion on: Axios: My experience with the library.

Collapse
gabrlcj profile image
Gabriel Bittencourt Author • Edited on

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()

Collapse
jcubic profile image
Jakub T. Jankiewicz • Edited on

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:

var res = await fetch('url');
var data = await res.json();
Enter fullscreen mode Exit fullscreen mode

see you also don't need to use .then(), this have nothing to do with axios.

Thread Thread
gabrlcj profile image
Gabriel Bittencourt Author

I see, I appreciate your explanation on the topic!