https://github.com/jsjoeio/use-streak
a streak counter to track your streak in days (similar to Duolingo)
https://github.com/jsjoeio/use-streak
browser duolingo streak typescript
Last synced: 6 months ago
JSON representation
a streak counter to track your streak in days (similar to Duolingo)
- Host: GitHub
- URL: https://github.com/jsjoeio/use-streak
- Owner: jsjoeio
- License: mit
- Created: 2021-10-09T14:58:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-21T21:36:47.000Z (about 3 years ago)
- Last Synced: 2025-04-10T13:12:49.052Z (6 months ago)
- Topics: browser, duolingo, streak, typescript
- Language: TypeScript
- Homepage:
- Size: 870 KB
- Stars: 39
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `useStreak` - a basic streak counter

This is a basic streak counter - inspired by Duolingo - written in TypeScript and meant for the browser (uses `localStorage`).
## Install
```shell
yarn add use-streak
``````shell
npm install use-streak
```### Usage
```typescript
import { useStreak } from "use-streak";const today = new Date();
const streak = useStreak(localStorage, today);
// streak returns an object:
// {
// currentCount: 1,
// lastLoginDate: "11/11/2021",
// startDate: "11/11/2021",
// }
```
[](https://codesandbox.io/s/vigorous-wood-o8m7w?fontsize=14&hidenavigation=1&theme=dark)
## LICENSE
MIT. Just make sure you give acknowledgements to this repo.