WeatherComponent is a React component that allows users to display current weather information based on their geolocation or a specific location.
- Fetches weather data from the OpenWeatherMap API.
- Displays weather information such as temperature, wind speed, humidity, and pressure.
- Supports geolocation-based weather fetching.
- Allows users to search for weather by location.
To use the WeatherComponent in your React project, follow these steps:
-
Install the package using npm:
npm install @mui/material @mui/icons-material
-
Import the WeatherComponent in your project:
import WeatherComponent from './WeatherComponent';
-
Use the
<WeatherComponent />
component in your JSX:<WeatherComponent />
The WeatherComponent can be used as follows:
<WeatherComponent />
To use the OpenWeatherMap API, you need to obtain an API key from their website. Once you have the API key, replace the API_KEY
variable in the WeatherComponent file with your own API key.
- Icons made by Freepik from www.flaticon.com