I’m trying to use reason-react together with reason-apollo. I’ve got a nested object, a response to a GraphQL query. I want to take a piece of it and pass it to the other component as a prop:
/* Parent component does this: */
<Message message=message/>
/* Message component: */
let make = (~message, _children) => {
...component,
render: _self => {
<section>
{str(message##direction->getWithDefault("-"))}
</section>
}
};
However, the types don’t match:
60 ┆ ->allMessages
61 ┆ ->Belt.List.map(message => {
62 ┆ <Message message=message/>
63 ┆ })
64 ┆ ->Belt.List.toArray
This has type:
option({. "direction": option(string)})
But somewhere wanted:
{.. "direction": option(string)}
So it complains that the object I got from ReasonApollo is a closed object, whereas my component expects to get an open object.
How do I deal with this?
Cheers!