mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
15 lines
459 B
ReasonML
15 lines
459 B
ReasonML
|
let component = ReasonReact.statefulComponent "Counter";
|
||
|
let make _children => {
|
||
|
...component,
|
||
|
initialState: fun () => 0,
|
||
|
render: fun self => {
|
||
|
let countMsg = "Count: " ^ (string_of_int self.state);
|
||
|
let onClick _evt {ReasonReact.state} => ReasonReact.Update (state + 1);
|
||
|
|
||
|
<div>
|
||
|
<p> (ReasonReact.stringToElement countMsg) </p>
|
||
|
<button onClick=(self.update onClick)> (ReasonReact.stringToElement "Add") </button>
|
||
|
</div>
|
||
|
}
|
||
|
};
|