I'm trying to define a ProductRow
and ProductCategoryRow
from Thinking in React.
productRow.re
let component = ReasonReact.statelessComponent("ProductRow");
let make = (~name, ~price, _children) => {
...component,
render: (_self) => {
<tr>
<td>{ReasonReact.stringToElement(name)}</td>
<td>{ReasonReact.stringToElement(price)}</td>
</tr>
}
};
productCategoryRow.re
let component = ReasonReact.statelessComponent("ProductCategoryRow");
let make = (~title: string, ~productRows, _children) => {
...component,
render: (_self) => {
<div>
<th>{ReasonReact.stringToElement(title)}</th>
</div>
}
};
I believe that I need to map
over the productRows
, i.e. List of ProductRow
's, with a function of: productRow => <td>productRow</td>
.
How can I do that in this example?
Or, if I'm completely off the mark, please explain how I can achieve the above.