rescript-lang.org icon indicating copy to clipboard operation
rescript-lang.org copied to clipboard

Document that you can do "intrinsic JSX elements"

Open zth opened this issue 6 months ago • 0 comments

Intrinsic JSX elements = lowercase JSX elements (<mesh /> from ThreeJs for example) that takes their own props, not just domProps which all lowercase JSX elements automatically do today.

This can be expressed already:

module Mesh = {
  type props = {
    position: (float, float, float),
    ref?: ReactDOM.domRef,
    scale?: float,
    onClick?: ReactEvent.Mouse.t => unit,
    onPointerOver?: ReactEvent.Mouse.t => unit,
    onPointerOut?: ReactEvent.Mouse.t => unit,
    children?: React.element,
  }

  @module("react/jsx-runtime") external make: (@as("mesh") _, props) => React.element = "jsx"
}

let rendered = <Mesh /> // will output <mesh> in the HTML

We need to document it.

zth avatar Feb 22 '24 14:02 zth