mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
f9c6e12037
* update dependencies * add bsconfig refmt version * update to new syntax * add dependency on concurrently for dev convenience * fix dev script
22 lines
529 B
ReasonML
22 lines
529 B
ReasonML
type action =
|
|
| Add;
|
|
|
|
let component = ReasonReact.reducerComponent("Counter");
|
|
|
|
let make = (_children) => {
|
|
...component,
|
|
initialState: () => 0,
|
|
reducer: (action, state) =>
|
|
switch action {
|
|
| Add => ReasonReact.Update(state + 1)
|
|
},
|
|
render: (self) => {
|
|
let countMsg = "Count: " ++ string_of_int(self.state);
|
|
<div>
|
|
<p> (ReasonReact.stringToElement(countMsg)) </p>
|
|
<button onClick=(self.reduce((_event) => Add))>
|
|
(ReasonReact.stringToElement("Add"))
|
|
</button>
|
|
</div>
|
|
}
|
|
}; |