1.0.3 • Published 4 years ago

use-season v1.0.3

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

use-season

0 dependencies react hooks to get the season based on the browser geo location api.

Installation :

  npm install use-season

Usage :

import React from 'react';
import useSeason from 'use-season';

function App() {
  const { error, loading, season, fetchSeason } = useSeason();
  if (loading) return <p>loading...</p>;
  return (
    <>
      {error && !season && error}
      {season && !error && season}
      <button onClick={fetchSeason}> Click me </button>
    </>
  );
}

export default App;

Note :

This package is based on the browser Geolocation API so, browser will ask you to use your location in that case you must click Allow else it won't work.

Demo

Check it out !

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago