0.1.0 • Published 6 years ago
stature v0.1.0
Stature
Get Started
Run yarn add stature
and add "stature"
to your BuckleScript dependencies list in bsconfig.json
.
Using the Library
// configuring your store
module CounterConfig = {
type t = int;
let debugName = "Counter";
let value = 0;
};
// creating your store
module CounterStore = Stature.CreateStore(CounterConfig);
// accessing state in ui
<CounterStore.Consumer
render=(
state =>
<View>
<Text>
(ReasonReact.stringToElement(string_of_int(state)))
</Text>
<Button onPress=(() => CounterStore.updateState(Some(CounterContext.state^ + 1)) label="Increment Counter" />
</View>
)
/>
0.1.0
6 years ago