user13787463
user13787463

Reputation:

Intercept errors in React js

In angular there is one feature call HttpInterceptor which intercepts Http request and it helps in converting http request before sending and after getting the response from the server. Is there something similar in React Js??

I would like to have the code centralised so that can be managed from one place.

Upvotes: 1

Views: 709

Answers (1)

dexter
dexter

Reputation: 1227

React doesn't do http calls. It's just a UI library. For data fetching you can use fetch, axios, etc. Axios has interceptors: https://github.com/axios/axios#interceptors

Upvotes: 1

Related Questions