Skip to content

Demo for teaching React props, state, and hooks to new students.

Notifications You must be signed in to change notification settings

ajtran303/weather_app_react_ts

Repository files navigation

Weather App React TS

A weather app built with React and Typescript with the Vite build tool.

Try the demo online

Skip straight to the fun part without setting anything up!

Local Setup

You must have node installed. Fork and clone this repo, cd into it and run npm install.

Get OpenWeatherMap API key

Use your API key

  • In this project's root directory, create a file named .env
  • In the .env file, write the following key-value pair:
# .env

VITE_OPEN_WEATHER_API_KEY=your_api_key_here
  • Make sure to save this file before moving on!

Note: This filename is added to .gitignore to protect your API key from being shared through version control (git).

Start the server

Use the npm run dev command to start serving the app on localhost:5173.

Hint: After running this command, while still focused in the terminal, press the o letter key to open the project in the browser.

Using the Weather App

  • Enter a location into the text field and then press the Enter key or click the Search button to submit your location.
  • If the location is a valid city, you will get weather results: the name of the city, a weather icon, a description, the current temperature, what it feels like, and the wind speed.
  • Results are not guaranteed to be accurate for a given location- in the cases of cities with the same name, the more "popular" location seems to be the returned result (eg. Denver, Colorado instead of Denver, Idaho or Paris, France (aka Palais-Royal) instead of Paris, Texas).
  • When given a location that cannot be found, you will be prompted to try again.

Project requirements checklist

About

Demo for teaching React props, state, and hooks to new students.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published