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

How to get Input Value in Rescript?

$
0
0

At few points, such “leap of faith” access is the best compromise to compensate for the super-dynamic nature of DOM and event handling.

Extracting the input value from an event is one such point.

I use the following helpers in order to minimise typos:

let getEventValue = e => {
  let target = e->JsxEvent.Form.target
  (target["value"]: string)
}

let getEventChecked = e => {
  let target = e->JsxEvent.Form.target
  (target["checked"]: bool)
}

Viewing all articles
Browse latest Browse all 1751

Trending Articles