An open API service indexing awesome lists of open source software.

https://github.com/tim-smart/value-notifier-ts


https://github.com/tim-smart/value-notifier-ts

Last synced: 9 months ago
JSON representation

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;
}
```