0.6.0 • Published 1 month ago
event-reduce-react v0.6.0
⚡ event-reduce-react ⚛
React integration for event-reduce, a small, opinionated, state management library based on reducing observable events into state.
Getting Started
Start by installing the package:
yarn add event-reduce-react
Hooks are provided for creating events, reductions, and derivations that persist between renders. Components that use reduced or derived properties should be wrapped in the reactive
HOC, so that the component will re-render when the model changes.
import { reactive, useEvent, useReduced } from "event-reduce-react";
export const MyComponent = reactive(function MyComponent() {
let increment = useEvent<number>();
let count = useReduced(0)
.on(increment, c => c + 1);
return <div>
Count: {count.value}
<button onClick={() => increment()}>Increment</button>
</div>
});
See the main event-reduce page for more information.
0.6.0
1 month ago
0.5.4
6 months ago
0.5.3
6 months ago
0.5.2
6 months ago
0.5.0
10 months ago
0.5.1
10 months ago
0.4.9
1 year ago
0.4.8
2 years ago
0.4.7
2 years ago
0.4.6
3 years ago
0.4.5
3 years ago
0.4.4
3 years ago
0.4.3
3 years ago
0.4.2
4 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.2
4 years ago
0.3.3
4 years ago
0.3.1
4 years ago
0.3.0
4 years ago