Hey,
how can i create Probs for Preact in Rescript, i am new to using JSX together with Rescript.
I mean for example onlick or onmousedown. Or other custom probs. Is there an way i could use events?
Can you show some js code you’re trying to convert?
Are you talking about probs or props?
May depend on your bindings but I do have an example at color-scheme-tool/src/App.res at 08c39c18aae4616e411a58375054ca05b4e714d5 · jaidetree/color-scheme-tool · GitHub
The key is:
onInput={e => {
e
->JsxEvent.Form.currentTarget
->DomUtils.Event.getValue
->Option.getOr("0e0e0e")
->Hex
->setSelectedColor
}}
JsxEvent.Form.currentTarget is built into the JSX module. DomUtils.Event.getValue is a custom binding for reading the .value
from an element (though could be better named).