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

What's the correct way to bind a React component with reserved keywords as prop names?

$
0
0

I have a binding for Headless UI Dialog that stopped working recently. Maybe after upgrading to Rescript 11. The generated JS now has _open instead of open and I’m not sure why. I tried underscore prefix and suffix but both failed to have any effect.

@react.component @module("@headlessui/react")
external make: (
  ~onClose: unit => unit,
  @as("open") ~_open: bool=?,
  ~children: React.element,
  ~className: string=?,
  @as("as") ~_as: string=?
) => React.element = "Dialog"

module Panel = {
  @react.component @module("@headlessui/react") @scope("Dialog")
  external make: (~children: React.element, ~className: string=?) => React.element = "Panel"
}

module Title = {
  @react.component @module("@headlessui/react") @scope("Dialog")
  external make: (~children: React.element, ~className: string=?, @as("as") ~_as: string=?) => React.element = "Title"
}


Viewing all articles
Browse latest Browse all 1991