Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Redefining the React children prop and its behavior in a binding

$
0
0

Hello,

I was creating a binding to a JS React component library which requires an array of children even when there is one single child.

How can I redefine the children prop in the binding so that the generated javascript jsx representation considers children to be an array always. Or as per this example, I would like el1 to generate a children array even when there is one child.

My binding is something like and I want to redefine the type of the children field:

type props<'value> = {
  className?: string,
  children?: React.element,
  ...
}
@module("module_name")
external make: React.component<props<'value>> = "Component"

Thanks in advance!


Viewing all articles
Browse latest Browse all 2592

Trending Articles