This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-06
Channels
- # aws-lambda (6)
- # babashka (1)
- # beginners (204)
- # calva (10)
- # chlorine-clover (17)
- # cider (57)
- # cljs-dev (3)
- # cljsrn (3)
- # clojure (148)
- # clojure-bangladesh (1)
- # clojure-berlin (3)
- # clojure-europe (30)
- # clojure-france (1)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (4)
- # clojure-uk (14)
- # clojurescript (15)
- # code-reviews (8)
- # conjure (27)
- # data-science (9)
- # datomic (38)
- # duct (6)
- # figwheel-main (11)
- # fulcro (78)
- # helix (11)
- # jobs (1)
- # malli (18)
- # meander (22)
- # mount (4)
- # nrepl (3)
- # off-topic (93)
- # pathom (2)
- # pedestal (4)
- # re-frame (5)
- # reagent (6)
- # reitit (1)
- # ring-swagger (1)
- # sci (1)
- # shadow-cljs (19)
- # spacemacs (1)
- # sql (1)
- # tools-deps (76)
- # unrepl (1)
- # vim (5)
- # xtdb (8)
Question: Why doesn't the state setter from use-state
behave like Clojure's update
, i.e. having a multi-arity version that takes a-fn and any number of arguments and runs (a-fn current-state args...)
? That way I could replace my (.then (fn [p] (set-state #(assoc % :person p))))
with the simpler (.then (fn [p] (set-state assoc :person p))))
?
because sometimes I just want to overwrite everything with a literal and not update the state
but I like that helix is just a shallow wrapper, maybe a custom hook that you write could do this? I am interested
Hm, the docs actually describe this functionality. I have to learn to read the docs fully 😅
No, everything is OK. I stopped trading the docs too early :)
I failed on that one, too!