Creating a weather app is one of the best beginner-friendly React projects to sharpen your skills while learning how to work with APIs. In this guide, you\’ll learn how to build a simple yet fully functional weather application using ๐ฅ๐ฒ๐ฎ๐ฐ๐ and the ๐ข๐ฝ๐ฒ๐ป๐ช๐ฒ๐ฎ๐๐ต๐ฒ๐ฟ ๐๐ฃ๐ in 2025.
๐ช๐ต๐ ๐๐๐ถ๐น๐ฑ ๐ฎ ๐ช๐ฒ๐ฎ๐๐ต๐ฒ๐ฟ ๐๐ฝ๐ฝ?
A weather app teaches you several essential development concepts, including:
- Fetching live data from APIs
- Managing component state
- Handling user input
- Working with async functions
- Displaying dynamic UI based on API responses
These skills are vital for real-world React applications.
๐ฆ๐๐ฒ๐ฝ ๐ญ: ๐ฆ๐ฒ๐ ๐จ๐ฝ ๐ฌ๐ผ๐๐ฟ ๐ฅ๐ฒ๐ฎ๐ฐ๐ ๐ฃ๐ฟ๐ผ๐ท๐ฒ๐ฐ๐
Start by creating a new React project:
npx create-react-app weather-app
cd weather-app
npm start
Your project will run at http://localhost:3000.
๐ฆ๐๐ฒ๐ฝ ๐ฎ: ๐๐ฒ๐ ๐ฎ๐ป ๐ข๐ฝ๐ฒ๐ป๐ช๐ฒ๐ฎ๐๐ต๐ฒ๐ฟ ๐๐ฃ๐ ๐๐ฒ๐
Visit https://openweathermap.org/api, create an account, and generate a free API key.
Youโll use the Current Weather Data endpoint:
https://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}
๐ฆ๐๐ฒ๐ฝ ๐ฏ: ๐๐ฟ๐ฒ๐ฎ๐๐ฒ ๐๐ต๐ฒ ๐ฆ๐ฒ๐ฎ๐ฟ๐ฐ๐ต ๐จ๐
Add an input field and button to allow users to search for a city:
<input
type=\"text\"
placeholder=\"Enter city\"
value={city}
onChange={(e) => setCity(e.target.value)}
/>
<button onClick={getWeather}>Search</button>
๐ฆ๐๐ฒ๐ฝ ๐ฐ: ๐๐ฒ๐๐ฐ๐ต ๐ช๐ฒ๐ฎ๐๐ต๐ฒ๐ฟ ๐๐ฎ๐๐ฎ
Use fetch() or axios inside an async function:
const getWeather = async () => {
const response = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric`
);
const data = await response.json();
setWeather(data);
};
๐ฆ๐๐ฒ๐ฝ ๐ฑ: ๐๐ถ๐๐ฝ๐น๐ฎ๐ ๐๐ต๐ฒ ๐ช๐ฒ๐ฎ๐๐ต๐ฒ๐ฟ ๐๐ป๐ณ๐ผ๐ฟ๐บ๐ฎ๐๐ถ๐ผ๐ป
Render temperature, humidity, wind speed, and weather conditions:
<h2>{weather.name}</h2>
<p>Temperature: {weather.main.temp}ยฐC</p>
<p>Humidity: {weather.main.humidity}%</p>
<p>Condition: {weather.weather[0].description}</p>
๐๐ถ๐ป๐ฎ๐น ๐ง๐ต๐ผ๐๐ด๐ต๐๐
With just a few lines of code, youโve built a fully functioning weather app using React and the OpenWeather API. You can enhance it by:
- Adding icons
- Showing 5-day forecasts
- Detecting user location
- Adding beautiful animations
This project builds a strong foundation for working with APIs and dynamic UIsโskills every modern frontend developer needs.
If you are looking for any services related to Website Development, App Development, Digital Marketing and SEO, just email us at nchouksey@manifestinfotech.com
#ReactJS #React #OpenWeatherAPI #WeatherApp #JavaScript #WebDevelopment #FrontendDevelopment #APIs #Coding #LearnReact #ReactProjects #WeatherAPI #FetchAPI #ModernWebDev #ReactTutorial #DevCommunity #Programming #100DaysOfCode #WebApp #DeveloperLife #ReactTips #React2025 #APIIntegration #OpenWeather #FrontendEngineer #CodeNewbie
