VOOZH about

URL: https://www.geeksforgeeks.org/reactjs/weather-application-using-reactjs/

⇱ Weather Application using ReactJS - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Weather Application using ReactJS

Last Updated : 26 Jul, 2025

In this article, we will develop an Interactive Weather Application using ReactJS Framework. The developed application will provide real-time weather information to the user for the city they have searched. If the user searches, for the wrong city, an Error message is also displayed to the user, stating that the searched city is not found.

We have used OpenWeatherMap API which provides us with access to weather data from around the world. We have fetched the weather information for various locations, including wind speed and more.

You can follow theWeather Forecast Projectto create your own weather application using HTML, CSS and JavaScript.

Let's have an interactive look at what our final project will look like:

👁 gfg

Prerequisites

Approach

  • Developed an interactive Weather Application using the ReactJS Framework.
  • Enabled users to search and get weather information for various cities in real time.
  • Integrated a weather API to fetch and display city-specific weather details based on user input.
  • Ensured the application is fully responsive, offering a consistent experience across all devices.
  • Delivered quick and accurate output upon city search to enhance user experience.
  • Implemented easy navigation between components for seamless user interaction.
  • Designed a user-friendly UI, making the application intuitive and simple to operate.
  • Incorporated various icons to enhance visual appeal and make the interface more engaging.

Project Structure

👁 PS

The dependencies in package.json will look likethis:

"dependencies": {
 "@fortawesome/free-solid-svg-icons": "^6.4.2",
 "@fortawesome/react-fontawesome": "^0.2.0",
 "@testing-library/jest-dom": "^5.17.0",
 "@testing-library/react": "^13.4.0",
 "@testing-library/user-event": "^13.5.0",
 "axios": "^1.4.0",
 "react": "^18.2.0",
 "react-dom": "^18.2.0",
 "react-loader-spinner": "^5.3.4",
 "vite": "^4.0.0",
 "web-vitals": "^2.1.4"
}

Steps to create the application

Step 1: Set up React project using the below command in VSCode IDE.

npm create vite@latest <<name of project>> --template react

Step 2: Navigate to the newly created project folder by executing the below command.

cd <<Name_of_project>>

Step 3: Install the required dependencies

npm install axios react-loader-spinner @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons

Steps to run the application:

1. Execute the following command in the terminal.

npm run dev

2. Open the web browser and type the following URL in the address bar.

http://localhost:5173/

Output:

👁 gfg

Comment