Hi. I wonder how to create recursive components in ReasonReact. For example, I have code:
let component = ReasonReact.statelessComponent("Comment");
let make = (~descendants, ~data, ~error, ~kidsOnly, _children) => {
{
...component,
render: (_self) =>
<div className={"comments"}>
{ switch error {
| true => ReasonReact.nullElement
| false => if (descendants > 0) {
<h2 className={"numberOfComments"}>{textEl({j|$descendants comments|j})}</h2>
} else {
ReasonReact.nullElement
}
}
}
{ switch error {
| true => <Text text={Some("Unable to load comments.")} isComment={false} />
| false => <section>
<Comment data={data} kidsOnly={true} />
</section>
}
}
</div>
}
}
and the error is
25 ┆ | true => <Text text={Some("Unable to load comments.")} isComment={fal
se} />
26 ┆ | false => <section>
27 ┆ <Comment data={data} kidsOnly={true} />
28 ┆ </section>
29 ┆ }
The module or file Comment can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `bsb` instead of `bsb -make-world`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?