Kevin Powell - CommunityKP-C
Kevin Powell - Community14mo ago
16 replies
Faker

Axios vs Fetch

Hello guys, sorry to disturb you all; I was just reading a bit about the difference between axios and fetch. From what I have understood, some of the differences is that axios already parse the data in the respond body and so we don't have to manually use something like response.json(). Similarly, when using post requests, axios don't need to include the JSON.stringify() method. By default it already does it. It also has some other benefits like a timeout argument which fetch doesn't have (I think).

My question is, I came across the term "interceptors". I read a bit about it, from what I have understood, it's just something use to modify the request before it is send or modify the response before it is sent back. But I didn't really understand why are interceptors used or why do we need it . Can someone explain please
Was this page helpful?