I’m getting the following error message, and I’m not sure what the issue is since I think I’m doing everything it’s asking.
This seems to be a ReasonReact reducerComponent? We don't have all the type
info for its state. Make sure you've done the following:
- Define the component `make` function
- Define `reducer` in that `make` body
- Annotate reducer's second parameter (state) with the desired state type at Array.map (<anonymous>)
at <anonymous>
And my code:
type field = {
name: string,
value: string,
};
type monster = list(field);
type state = {
monster: monster
}
type action =
| AddField(field)
| SaveFields;
let component = ReasonReact.reducerComponent("MonsterEdit");
let make = (_children) => {
...component,
reducer: (action, _state) => {
switch(action) {
| _ => ReasonReact.NoUpdate
}
},
initialState: () =>
{monster: [
{ name: "name", value: "" },
{ name: "description", value: ""}
]},
render: _self => {
<div>(ReasonReact.string("hello"))</div>
}
}