nosco / hx

A simple, easy to use library for React development in ClojureScript.
MIT License
247 stars 16 forks source link

weird closing over <-state with <-effect #13

Closed lilactown closed 5 years ago

lilactown commented 5 years ago
  (let [state (<-state {:log [{:foo ["bar" "baz"]
                               :bar {:baz 42}}]
                        :history []
                        :current {:foo ["bar" "baz"]
                                  :bar {:baz 42}}
                        :next {:coll nil
                               :k nil
                               :v nil}})
        tap-fn (fn [x]
                 (swap! state update :log conj x))]
    ;; add tap listener
    (<-effect (fn []
                (println "Adding tap")
                (add-tap tap-fn)
                (fn []
                  (printlin "removing tap")
                  (remove-tap tap-fn)))
              [state])
lilactown commented 5 years ago

This was due to not passing in [state] as a JS array.