I have this simple component
let component = ReasonReact.statelessComponent("Input");
let make = (~name, ~onChange, ~value, _children) => {
...component,
render: (_self) =>
<input
name=name
onChange={(_) => {
onChange(name, "change")
}}
value=value />
};
and I'm trying to use it like this
<Input
name="
placeholder="Your email"
onChange={self.reduce((name, value) => Change(name, value))}
label=""
value={self.state.email} />
But I get this error on the onChange
line
This is:
ReasonReact.Callback.t(string) (defined as (string) => unit)
But somewhere wanted:
(string, string) => unit
The incompatible parts:
unit
vs
(string) => unit
I think I understand the error, but I have no idea to to fix it. I also to define onChange
like this
onChange={(name, value) => self.reduce((_, _) => Change(name, value))}
but this time I get
This is:
ReasonReact.Callback.t('a) (defined as ('a) => unit)
But somewhere wanted:
unit
Do you have an idea how to fix it ? Is it possible to call reduce
inside another callback function ?