-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
This code performs a 1 second debounce as I would expect:
(ns todomvc.core
(:require [reacl-c.main :as main]
[reacl-c.dom :as dom :include-macros true]
[reacl-c.core :as c :include-macros true]
[reacl-c-basics.debounce :as debounce]))
(defn init []
(main/run
(.getElementById js/document "app")
(c/fragment
(c/dynamic pr-str)
(debounce/debounce-delay 1000 (c/with-state-as st
(dom/div
;; add this line to notice the flip-flop behaviour:
;; (c/init (c/return))
(dom/button {:onclick not}
(pr-str st))))))
{:initial-state false}
))
When you uncomment the (c/init (c/return)) line, the behaviour changes: Now when you click the button, the state toggles between true and false every second.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels