Not sure what you are trying to achieve, but in idiomatic ReScript / React, you’d type children as a React.element (instead of list<React.element>), since this is what children are (even if there are multiple children).
Example:
module MyComponent = {
@react.component
let make = (~children: React.element) => {
<div> children </div>
}
}
module Test = {
@react.component
let make = () => {
<MyComponent>
<div> {React.string("child 1")} </div>
<div> {React.string("child 2")} </div>
</MyComponent>
}
}
Let’s assume you’d still want to pass your children as a list<React.element>, you’d need to do something like this:
module MyComponent = {
@react.component
let make = (~children: list<React.element>) => {
<div> {Belt.List.toArray(children)->React.array} </div>
}
}
module Test = {
@react.component
let make = () => {
let children = list{
<div> {React.string("child 1")} </div>,
<div> {React.string("child 2")} </div>,
}
<MyComponent> children </MyComponent>
}
}
I personally would recommend to never use list for this particular use-case, since it will always introduce extra runtime overhead when converting lists to arrays.
Since you enabled your JSX config in bsconfig.json, the representation you mentioned above will be converted to the React-specific React.createElement(comp, props) instead. You would have been correct with your assumption if your JSX setting would have been disabled.
Or to phrase it differently, when using ReScript w/ React, you always have two transformations in the JSX syntax. 1) From JSX to annotated @JSX MyComponent.createElement(...), which gets transformed by our builtin react-jsx-ppx (v3).
Right now, the official docs for rendering all the different primitive values are here