https://github.com/adarshaacharya/use-season
https://github.com/adarshaacharya/use-season
react
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/adarshaacharya/use-season
- Owner: adarshaacharya
- Created: 2020-08-27T08:22:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-27T17:35:37.000Z (about 5 years ago)
- Last Synced: 2025-01-30T22:10:05.188Z (9 months ago)
- Topics: react
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/use-season
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-season
0 dependencies react hooks to get the season based on the browser geo location api.
## Installation :
```bash
npm install use-season
```
## Usage :
```jsx
import React from 'react';
import useSeason from 'use-season';
function App() {
const { error, loading, season, fetchSeason } = useSeason();
if (loading) return
loading...
;
return (
<>
{error && !season && error}
{season && !error && season}
Click me
>
);
}
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 !](https://codesandbox.io/s/use-season-example-1zp6z)