Minimal React + Vite app to quickly check weather for any city using OpenWeatherMap.
Getting started
- Install dependencies
npm install- Add your OpenWeather API key in a
.envfile at the project root:
VITE_OPENWEATHER_KEY=YOUR_KEY_HERE
- Run the dev server
npm run devFeatures
- Search by city name (controlled input)
- Loading and error states
- Toggle between °C and °F (converts locally)
- Shows weather icon
- Saves last searched cities to localStorage
Notes
- This app uses
import.meta.env.VITE_OPENWEATHER_KEYfor the API key (Vite convention). - If you prefer toggling to always re-fetch for the other unit, change
handleUnitToggleto call the API again.