React Axios

1. Axios là gì ?

Documentation: https://axios-http.com/docs

2. Sử dụng Axios

Sử dụng theo kiểu : Async/Await or Promise

Post Request:

axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Multiple concurrent Requests

2.1 Config Axios

Config Axios

2.2 Create Instance

2.3 Request config and Response Schema

3. Axios in React

Folder Construction

API config

Use Axios

4. Axios with file(image, videos) upload

Last updated

Was this helpful?