https://github.com/cawfree/react-use-debby
Optimize successive updates to a particular value.
https://github.com/cawfree/react-use-debby
debounce react react-native state value
Last synced: 3 months ago
JSON representation
Optimize successive updates to a particular value.
- Host: GitHub
- URL: https://github.com/cawfree/react-use-debby
- Owner: cawfree
- License: mit
- Created: 2020-10-07T01:14:40.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-10-07T01:59:00.000Z (almost 6 years ago)
- Last Synced: 2025-08-19T20:53:46.271Z (11 months ago)
- Topics: debounce, react, react-native, state, value
- Language: JavaScript
- Homepage:
- Size: 134 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-use-debby
Optimize successive updates to a particular value. It's like a time filter you can apply inline to received values, and it's useful for debouncing rapid changes to a value without writing a dedicated debouncing function.
## 🚀 Getting Started
Using [**Yarn**](https://yarnpkg.com):
```bash
yarn add react-use-debby
```
## ✍️ Usage
```javascript
import React, { useState } from "react";
import { View, Text, Button } from "react-native";
import { useDebby } from "react-use-debby";
export default function App() {
const [count, setCount] = useState(0);
const debbiedCount = useDebby()(count);
// Matches lodash.debounce.
// const debbiedCount = useDebby(1000, {leading: true})(count);
return (
<>
setCount(cnt => cnt + 1)} title="Increment" />
>
);
}
```
## ✌️ License
[**MIT**](./LICENSE)