-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Hi, I was trying out the Brr backend and had a couple of questions.
let ui =
let count = Lwd.var 0 in
let on_click () = Lwd.set count (Lwd.peek count + 1) in
let button =
Lwd.map
~f:(fun i ->
let btn = El.button [El.txt' (string_of_int i)] in
Ev.listen Ev.click (fun _e -> on_click ()) (El.as_target btn);
btn)
(Lwd.get count)
in
Elwd.div [`R button]The rest of the file is the same as in the Brr example. If I replace the last line with button, the button no longer updates.
- I'm guessing this is due to the mismatch between the pure interface and the statefulness of the DOM. Should we always ensure that the top-level node is not dynamic, or is there a better workaround? Maybe this could be documented somewhere.
- Is this what the commented line is meant to address?
Anyway, I really like Lwd so far, awesome work!
let-def
Metadata
Metadata
Assignees
Labels
No labels