Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abians/zustand-debounce
zustand-debounce is a library that extends the capabilities of Zustand to provide a JSON state storage system with delayed (debounced) writing to storage.
https://github.com/abians/zustand-debounce
debounce react reactjs zustand zustand-debounce zustand-persist
Last synced: 10 days ago
JSON representation
zustand-debounce is a library that extends the capabilities of Zustand to provide a JSON state storage system with delayed (debounced) writing to storage.
- Host: GitHub
- URL: https://github.com/abians/zustand-debounce
- Owner: AbianS
- License: mit
- Created: 2023-10-17T19:37:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-01T10:48:49.000Z (about 2 months ago)
- Last Synced: 2024-10-12T16:32:54.921Z (about 1 month ago)
- Topics: debounce, react, reactjs, zustand, zustand-debounce, zustand-persist
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/zustand-debounce
- Size: 128 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zustand Debounce
zustand-debounce is a library that extends the capabilities of [Zustand](https://github.com/pmndrs/zustand) to provide a JSON state storage system with delayed (debounced) writing to storage. With this tool, you can reduce the number of write operations to storage by delaying and grouping them.
✅ 🐙 Lightweight!! 367 B gzipped.
✅ 🚀 Easy integration into your projects.
✅ 🕒 Customize the debounce time according to your needs.
✅ 🔄 Avoid frequent writes to storage.
✅ Full TypeScript support.
## Installation
```bash
pnpm add zustand-debounce
# o
npm install zustand-debounce
# o
yarn add zustand-debounce
```## Usage
```ts
import { createDebouncedJSONStorage } from "zustand-debounce"// Replace createJSONStorage with createDebouncedJSONStorage
// Experience the enchantment of delayed writes ✨
export const usePersonStore = create()(
persist(storeApi, {
name: "person-storage",
storage: createDebouncedJSONStorage(firebaseStorage, {
debounceTime: 2000, // Debounce time in milliseconds ⏳
}),
}),
)
```## Contributions
Contributions are welcome. If you find an issue or have an idea to improve zustand-debounce, feel free to open an issue or submit a pull request.
## License 📜
Licensed as MIT open source.
with 💖 by AbianS