This is a weather app that allows users to search for a city and see the current weather conditions.
To get started, clone the repository and install the dependencies.
git clone https://github.com/vishwasholla/weather-app.git
cd weather-app
npm install
To run the app, simply run the following command:
npm start
The app will then be available at http://localhost:3000.
The code for this app is located in the src
directory. The main component is the App
component, which is located at src/App.js
. This component is responsible for rendering the search bar and the current weather conditions.
The search bar is implemented using the react-select-async-paginate
library. This library provides a simple way to create an asynchronous search bar. The search bar is connected to the onSearchChange
function, which is passed to the Search
component.
The onSearchChange
function is responsible for fetching the current weather conditions for the city that the user has selected. The function uses the fetch
API to make a request to the OpenWeatherMap API. The response from the API is then parsed and passed to the CurrentWeather
component.
The CurrentWeather
component is responsible for rendering the current weather conditions for the city that the user has selected. The component uses the data that is passed to it from the onSearchChange
function to render the weather conditions.
To deploy the app, you can use a service like Heroku or Netlify. Heroku and Netlify both provide a simple way to deploy a React app.
Once you have deployed the app, you can share the URL with your users.
This weather app is a simple but powerful example of how to use React to create a user interface. The app is easy to use and understand, and it can be easily customized to meet your needs.