Skip to content

REACT Best Practices Making HTTP Requests

Patrick Alvin Luwum edited this page Jun 20, 2018 · 1 revision

Use axios library for http requests over jQuery ajax

Fetch API and axios are the most preferable ways of making http requests. Between those two there are some advantages of using axios library.

They are:

  • It allows performing transforms on data before request is made or after response is received.
  • It allows 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.