Yes, with the generic JSX transform: JSX | ReScript Language Manual
The same way how you would bind to Preact you can also “overwrite” the React bindings that are shipped with the compiler. Here is a short example:
module ReactDOM = { // actually its own file like "MyReactDom.res"
module JsxDOM = {
@unboxed
type range =
| @as("any") Any
| String(string)
| Int(int)
type domProps = {
...JsxDOM.domProps,
step_?: range,
}
type domRef = JsxDOM.domRef
}
// ... cut for brevity, look at the playground example please
}
@react.component
let make = () =>
<>
<input type_="range" min="0" max="100" step_=Any />
<input type_="range" min="0" max="100" step_=Int(50) />
<input type_="range" min="0" max="100" step_=String("10") />
</>
Don’t forget to add the file with the bindings to your rescript.json:
"jsx": {
"module": "MyReactDom"
},
Well, actually you cannot overwrite existing props, that’s why I called the new one step_
.
But we would not mind a PR either, here is the source: rescript/runtime/JsxDOM.res at 4a5c3ea20875d29d6c2acb479849852674eb498a · rescript-lang/rescript · GitHub