Build a monitoring dashboard with AJAX, Promise and React Hooks

Image for post

By reading this piece, you will learn to create a simple React-based monitoring dashboard which shows the air quality information based on a city selected by the users. Here is an example of the monitoring dashboard.

Image for post

We are going to utilize AJAX, Promise and React Hooks for this tutorial.

1. React Hooks

For your information, React Hooks are

“… a new addition in React 16.8. They let you use state and other React features without writing a class.”

Hooks is a powerful feature in the latest version of React as it offers a standardized and re-usable approach which cannot be done via classes. Hooks provide a mean to extract logic and state from a component. You can reuse the logic and state independently without the need to change the hierarchy of your component.

By default, React provides us with two types of hooks:

  • State Hook
  • Effect Hook

#react #air-quality #javascript #react-hook #web-development

Simplifying Air Quality Data Fetching with React Hooks
1.55 GEEK