@react.component
let make = (~children) => {
let handleClick = (e) => {
Js.log(e["target"])
}
<button onClick={e => handleClick(e)}> children </button>
}
-
ehas the typeReactEvent.Mouse.t - You are handling
eas if it was an openJs.ttype{.. "target": 'a}
To solve this, you need to first use ReactEvent.Mouse.target to convert the event into an open Js.t:
@react.component
let make = (~children) => {
let handleClick = (e) => {
ReactEvent.Mouse.target(e)->Js.log
}
<button onClick={e => handleClick(e)}> children </button>
}
Also see Playground Example.
1 Like
