Sometimes, we want to make axios synchronous with JavaScript.
In this article, we’ll look at how to make axios synchronous with JavaScript.
How to make axios synchronous with JavaScript?
To make axios synchronous with JavaScript, we use the await keyword.
For instance, we write
const response = await axios.get("/api/persons/unique/alias");
to call axios.get to make a get request and return a promise with the response.
Then we use await to wait for the response and get it.
Conclusion
To make axios synchronous with JavaScript, we use the await keyword.
