This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-14
Channels
- # aleph (2)
- # announcements (11)
- # aws (4)
- # babashka (42)
- # babashka-sci-dev (81)
- # beginners (90)
- # biff (2)
- # calva (40)
- # cider (16)
- # clj-kondo (26)
- # clj-on-windows (1)
- # cljdoc (4)
- # cljfx (1)
- # cljsrn (2)
- # clojure (92)
- # clojure-austin (2)
- # clojure-europe (23)
- # clojure-nl (5)
- # clojure-uk (3)
- # clojured (3)
- # clojurescript (19)
- # community-development (3)
- # conjure (1)
- # cursive (4)
- # datalevin (3)
- # datomic (5)
- # emacs (13)
- # events (1)
- # fulcro (26)
- # graphql (1)
- # hugsql (15)
- # introduce-yourself (5)
- # leiningen (1)
- # lsp (29)
- # minecraft (19)
- # music (1)
- # off-topic (36)
- # pathom (12)
- # podcasts (2)
- # portal (8)
- # re-frame (12)
- # reagent (11)
- # rewrite-clj (4)
- # shadow-cljs (56)
- # spacemacs (2)
- # vim (12)
- # windows (3)
- # xtdb (43)
With a from-2 component, what's the significance of the arguments of the inner and outer function? I think the docs tell you that they should be the same, but I've seen code where the inner just did not take arguments.
The outer function sets the arguments upon entry, the inner function sets them on rerender?
Yea but what happens when the list of arguments is not the same?
basically you would lose the ability to update an argument in a rerender. If I add an extra argument on the outer function but not in the rerender function it will not update in the rerender I guess. Not an expert.
Mostly what I've seen is where the inner fn just takes no args... maybe that's valid if you only use the args in the outer fn? not sure
here is a scenario that would fail I think
(defn wont-update [x]
(let [] ;; here you would prob declare some inner state with an r/atom
(fn []
(println x))))
;; (wont-update 3) -> 3
;; (let [input (r/atom 2)]
(wont-update @input) ;; -> 2
(reset! input 5)
(wont-update @input) ;; -> 2
Yea using x in the inner fn while not passing it to the inner function is clearly wrong.
Anyone aware of any good patterns/libraries for partitioning a map (example with a reagent element)
(defn my-element [{:keys [key1 key2] :as props} & children]
; Do stuff with key1 and key2
; Pass down remaining props to :div
[:div (dissoc props :key1 :key2) ...])
Wanted to ask before I write my own defn
wrapper macro that has support for something like [{:keys [key1 key2] :as props :remaining other-props} ...}