Return to site

REACT: Do a simple HTTP GET

=> How to call ๐Ÿ“ž a backend to read data via REST API in React

October 8, 2022

So it was time for me to learn how to interact ๐Ÿ”ƒ with backend with a react App.

And I used Axios to do so.

Axios is a simple promise-based HTTP client for the browser and node.js.

Axios provides a simple-to-use ๐Ÿ˜„ library in a small package with a very extensible interface.

So I coded ๐Ÿ‘จโ€๐Ÿ’ป a simple react app which:

->fetches ๐Ÿถ with axios a data object in the JSON format

->displays ๐Ÿ“บ its fields in the middle of the screen

 

Here is the code ๐Ÿ‘‡ if you wanna play with it, just download itโฌ‡๏ธ, and run it from its directory with 'npm start'๐Ÿš€

#react #axios #callBackend #get