https://github.com/tim-smart/value-notifier-ts
https://github.com/tim-smart/value-notifier-ts
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tim-smart/value-notifier-ts
- Owner: tim-smart
- Created: 2022-09-21T00:40:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-15T03:36:47.000Z (about 3 years ago)
- Last Synced: 2025-08-29T10:33:22.313Z (10 months ago)
- Language: TypeScript
- Size: 63.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# value-notifier-ts
Inspired by `ValueNotifer` from Flutter, `valueNotifer` is a simple way of
listening to changes and updating a value.
## Example
```typescript
import { valueNotifer } from "value-notifier-ts";
import { useValueListenable } from "value-notifier-ts/react";
const counter = valueNotifer(0);
export function CounterText() {
const count = useValueListenable(counter);
return
Current count: {count};
}
export function CounterButton() {
const increment = () => counter.update((count) => count + 1);
return Increment;
}
```