react-weather-station

2.0.3 • Public • Published

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

Properties type default description
location string '' The location to fetch the weather for
theme string 'main'
color string 'secondary The little splashes of colors
moreDetails boolean false wether to show more details or not

Package Sidebar

Install

npm i react-weather-station

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

110 kB

Total Files

7

Last publish

Collaborators

  • axelmy