以下を考えると:
$cat src/Greeting.re
let component = ReasonReact.reducerComponent("Greeting");
type action =
| Click;
type state = {
count: int
};
let make = (_children) => {
...component,
initialState: () => {count: 0},
reducer: (action, state) =>
ReasonReact.Update({count: state.count + 1}),
render: (self) => {
let message = "Clicked " ++ string_of_int(self.state.count) ++ "x";
<div>
<button
onClick={_event => self.send(Click)}
/>
{ReasonReact.stringToElement(message)}
</div>
}
};
次のコンパイル時エラーが発生します。
17 ┆ <div>
18 ┆ <button
19 ┆ onClick={_event => self.send(Click)}
20 ┆ />
21 ┆ {ReasonReact.stringToElement(message)}
This record expression is expected to have type
ReasonReact.componentSpec (state, 'a, 'b, 'c, 'd)
The field send does not belong to type ReasonReact.self
ninja: build stopped: subcommand failed.
>>>> Finish compiling(exit: 1)
理解できない。誰かがエラーの内容と修正方法を説明してもらえますか?