This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-28
Channels
- # aleph (4)
- # announcements (5)
- # babashka (28)
- # babashka-sci-dev (13)
- # beginners (63)
- # calva (76)
- # cider (113)
- # clara (7)
- # clj-kondo (42)
- # cljdoc (1)
- # clojure (170)
- # clojure-europe (20)
- # clojure-nl (17)
- # clojure-norway (3)
- # clojure-spec (12)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (55)
- # clojureverse-ops (1)
- # consulting (1)
- # core-async (9)
- # cursive (16)
- # data-science (1)
- # datascript (8)
- # datomic (27)
- # emacs (14)
- # events (1)
- # fulcro (10)
- # graphql (9)
- # gratitude (1)
- # jobs (6)
- # jobs-discuss (5)
- # leiningen (10)
- # lsp (35)
- # missionary (4)
- # nextjournal (9)
- # off-topic (46)
- # pathom (15)
- # pedestal (5)
- # polylith (37)
- # portal (15)
- # re-frame (22)
- # reagent (4)
- # reitit (5)
- # reveal (18)
- # shadow-cljs (20)
- # tools-deps (7)
- # xtdb (10)
Hey all, one of the last struggles Im facing with reframe is making sure there's a :key for lists.. Where would I annotate the key in the following map:
(map #(vec (person-detail-one-up (util/labelize-keyword (:type %)) (:name %))) (:established-providers person))
(defn person-detail-one-up [label1 value1]
[:div {:className "p-formgrid p-grid"}
[:div {:className "p-field p-col"}
[:label {:className "p-col-6 detail-label two-col"} label1]
[:span value1]]])
:established-providers [{:id 1 :type :primary-care :name "Dr. Larry Arbogast"}
{:id 2 :type :cardiologist :name "Dr. Mantis Toboggan"}
{:id 3 :type :pulmonologist :name "Dr. Pembry"}
{:id 5 :type :ob-gyn :name "Dr. Jack Carmichael"}
{:id 6 :type :physical-therapy :name "Dr. Horniker"}]
(for [provider (:established-providers person)]
[person-detail-one-up (util/labelize-keyword (:type provider)) (:name provider))])
using [] around the person-detail-one-up
component allows us to add the key annotation
(for [provider (:established-providers person)]
^{:key (:id provider)} [person-detail-one-up (util/labelize-keyword (:type provider)) (:name provider)])
Thanks @U4YGF4NGM 🙂
will have a nil in the dispatch-n vector do anything? we want do things conditionally. e.g dispatch-n [(when x y)]
at my last spot we would (cond-> [] condition? (conj [:event ...]))
. and you could also (into [] (filter some? [(when ...)]))
@dpsutton i should have been more clear about the use case, it's my understanding that the order matters in our dispatch-n and so conjing wont work because it needs to be somewhere specific.
In your dispatch-n the order matters as long as you don't perform side effects in your handlers. In that case, there's no guarantee one side effect will take place before the next handler call. Also, what @dpsutton wrote would still ensure the order .. you just do it programmatically
the filter with some would, yes, i didn't see that example. Thanks 🙂