Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that you can do "intrinsic JSX elements" #818

Open
zth opened this issue Feb 22, 2024 · 0 comments
Open

Document that you can do "intrinsic JSX elements" #818

zth opened this issue Feb 22, 2024 · 0 comments

Comments

@zth
Copy link
Collaborator

zth commented Feb 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant