Working with AJAX in React #1

This example shows how data cat be fetched from an api and displayed in a Component.

AJAX Utility


To fetch data from api a utility library is required. In this example axios is used.

> npm install axios

Index


index.html

index.js



App (React Component)


App.js (import axios here)

App.css

The resulting UI will be

Share