I’m new to the ReasonML world and
I’m trying to add an EventListener on a Dom.element
open Webapi.Dom; let item = document |> Document.querySelector(".item"); let handleClick = (_) => Js.log("click"); Document.addEventListener("click", handleClick, item);
but I have an error for the type of the item variable
Error: This expression has type option(Dom.element) but an expression was expected of type Webapi.Dom.Document.t = Dom.eventTarget_like(Dom._node(Dom._document(Dom._baseClass)))
But I didn’t find any solution, so if you know how to do that with ReasonML,
I would be happy to know the answer.