monkeyjs
monkeyjs

Reputation: 612

axios vs fetch - when making an api call

Which do you prefer and did you see any benefits using axios - when we can use a normal fetch while making api calls? Did any one had to change to axios for any specific use case?

Upvotes: 2

Views: 1386

Answers (1)

Lead Developer
Lead Developer

Reputation: 1169

Overall they are very similar. Some benefits of axios:

Transformers: allow performing transforms on data before request is made or after response is received

Interceptors: allow you to alter the request or response entirely (headers as well). also perform async operations before request is made or before Promise settles

Built-in XSRF protection

To get more answers, please visit this link. what advantage does axios give us over fetch

Upvotes: 2

Related Questions