https://github.com/tochy97/weather
A react component utilizing open-meteo. It also includes a function for retrieving open-meteo data restructured to be more user friendly.
https://github.com/tochy97/weather
node open-meteo reactjs typescript webpack
Last synced: 5 months ago
JSON representation
A react component utilizing open-meteo. It also includes a function for retrieving open-meteo data restructured to be more user friendly.
- Host: GitHub
- URL: https://github.com/tochy97/weather
- Owner: tochy97
- Created: 2024-11-24T12:44:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-11T11:16:35.000Z (over 1 year ago)
- Last Synced: 2025-10-22T21:55:20.803Z (9 months ago)
- Topics: node, open-meteo, reactjs, typescript, webpack
- Language: TypeScript
- Homepage:
- Size: 1.68 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Weather
A react component utilizing open-meteo. It also includes a function for retrieving open-meteo data restructured to be more user friendly.
## Installation
```bash
npm install @egeonu/weather
```
## Usage
### getWeatherOpenMeteo
```javascript
import React from 'react'
import ReactDOM from 'react-dom/client';
import { getWeatherOpenMeteo } from '@egeonu/weather';
// Accepts url
let url = (latitude: number, longitude: number) => "https://api.open-meteo.com/v1/forecast?latitude=" + latitude + "&longitude=" + longitude + "&hourly=temperature_2m,relative_humidity_2m,precipitation_probability,weather_code,wind_speed_10m,wind_direction_10m";
const weather = await getWeatherOpenMeteo(url(32.679420,-97.028336),'f');
console.log(weather);
```
#### Expected output
[Example Output](weather-array.json)
This example shows how we budle all the data by date and hours. The object type for each forcast is defined to be `any` since it accepts a url and parameters can change.
### ReactWeather
```javascript
import React from 'react'
import ReactDOM from 'react-dom/client';
import ReactWeather from '@egeonu/weather';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.Weather(
);
```
#### Example Output

## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Please make sure to update tests as appropriate.