bs-effector
v20.0.0
Published
Reason bindings for effector
Downloads
13
Readme
bs-effector
ReasonML bindings for effector.
Installation
npm install --save bs-effector
Then add bs-effector to bs-dependencies in your bsconfig.json
:
{
"bs-dependencies": ["bs-effector"]
}
Usage
open Effector;
let counter = Store.make(0);
let increment: Event.t(unit) = Event.make("increment");
let decrement: Event.t(unit) = Event.make("decrement");
Store.(
counter
|> on(increment, (state, payload) => state + 1)
|> on(decrement, (state, payload) => state - 1)
);
let text = Store.make("hello world");
let d = Store.(counter |> map(v => "test"));
counter |> Store.watch(state => Js.log(state));
increment |> Event.watch(state => {
Js.log({j|event $state|j});
});