Setup
- Fake http data from https://jsonplaceholder.typicode.com/
- Use Axios package
npm install axios --save
- Axios docs: https://github.com/axios/axios
Fetch data with axiom
1 | import axios from 'axios'; |
Fetch data on update
1 | state = { |
Post data
1 | postDataHandler() { |
Delete data
1 | deletePostHandler = () => { |
Setting up Interceptors to execute code globally
1 | import axios from 'axios'; |
Axios Instance
1 | // Create an axios.js |