mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
17 lines
297 B
Markdown
17 lines
297 B
Markdown
# `useCallbag`
|
|
|
|
React state hook that tracks the latest value of a callbag.
|
|
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useCallbag} from 'react-use';
|
|
import interval from 'callbag-interval';
|
|
|
|
const Demo = () => {
|
|
const count = useCallbag(() => interval(1000));
|
|
return <span>{`Counter: ${count}`}</span>
|
|
};
|
|
```
|