Minimalistic react weather component.
- Beautiful Widgets
- Minimal Design
- Supports openweathermap API
- Extendable to more external API'S
- Simple & Minimal API.
Install via npm:
npm install react-weather --save
This example shows how to use the GenericWeather component. The component display static data via props.
import ReactDOM from 'react-dom';
import { GenericWeather } from 'react-weather';
ReactDOM.render(
<GenericWeather city="Jerusalem" temp=17.61 status="sun" />,
document.getElementById('root')
)
https://openweathermap.org/api - Get real time weather via Openweathermap api.
import ReactDOM from 'react-dom';
import { OpenWeatherMap } from 'react-weather';
ReactDOM.render(
<OpenWeatherMap city="Jerusalem" country="IL" appid="your-api-key" />,
document.getElementById('root')
)
The basic component is GenericWeather. this component is the main component, all the other components use it.
<GenericWeather />
props:
- city - The city name
- temp - the temperature
- status - the icon to show - meanwhile it's just sun / rain
This component use the openweathermap api to get weather data. the component fetch using axios data from the api, and render the GenericWeather for you.
<OpenWeatherMap />
props:
- city - The city name - required
- country - The country code - not required
- appid - The api key from openweathermap - required
- units - The units of the temperature - metric / imperial - not required, default is metric
ReactWeather is inspired by Soumya Ranjan Bishi credits to Alberto Jerez about the sass code
MIT