Category
React
Position
  • Personal
Year
2021

React Weather App

My first React app is a weather app that fetches data from Open Weather Map API.

It shows the current weather, other info such as wind, humidity, sunrise/sunset, and the weather for the next five days.

main image

Get the local weather by Geolocation API

Built with state hooks and uses the Geolocation API to display the weather of the user’s current location when the page is loaded.
You can also load the local weather forecast by pressing the location icon.

Auto-suggest feature on the input field

To make it easier to search city names, I added an auto-suggestion feature with regular expression objects(RegExp) that make to match character combinations in strings on the input field, using ‘city.list.json’ file that is distributed by Open Weather Map.

 

Changing background colour by time and weather condition

The background colour changes by the time of day: morning, noon, evening, and night, also by the weather condition (ie: sunny, cloudy/rain)