Loading Todos from the API with the axios framework

We want to start using the API to fetch the todo details and use the API to insert a todo. Axios is a popular framework that is used to make RESTful API calls from React applications. Some important features of the axios framework are as follows:

  • Making RESTful API calls from the browser
  • Request and response interception
  • Transformation of JSON data
  • Protection against XSRF attacks

You can stop the todo React application and add axios by executing the npm add axios command at the Command Prompt. package.json reflects the new framework added in—axios:

"dependencies": { "axios": "^0.18.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "3.0.0" },
Make sure that you start the ...

Get Mastering Spring 5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.