2.0.3 • Published 2 years ago

react-weather-station v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-weather-station 👋

A customizable react component that displays weather informations about a given city

Installation

npm i react-weather-station

Demo & examples 👀

https://axelmy-projects-showcase.firebaseapp.com/react-weather-station (...with code 😉)

Screenshots

Using the WeatherWidget component screenshots

Using the WeatherPanel provider screenshotPanel

Usage 💻

import React, { useState, useRef } from 'react';
import { WeatherWidget } from 'react-weather-station';

const BasicExample = () => {
    const [location, setLocation] = useState('lausanne')
    const locationRef = useRef()

    return (
        <>
            <input ref={locationRef} type='text' />&nbsp;
            <button onClick={() => setLocation(locationRef.current.value)}>search</button>
            
            <div style={{marginTop: '10px'}}></div>

            <WeatherWidget location={location} />
        </>
    );
};

export default BasicExample;

API ✔

Propertiestypedefaultdescription
locationstring''The location to fetch the weather for
themestring'main'
colorstring'secondaryThe little splashes of colors
moreDetailsbooleanfalsewether to show more details or not