This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-10
Channels
- # announcements (16)
- # aws (1)
- # babashka (2)
- # beginners (33)
- # biff (2)
- # clj-kondo (13)
- # cljs-dev (1)
- # cljsrn (3)
- # clojars (6)
- # clojure (198)
- # clojure-australia (3)
- # clojure-europe (41)
- # clojure-france (3)
- # clojure-nl (2)
- # clojure-spec (7)
- # clojure-uk (12)
- # clojurescript (57)
- # clojureverse-ops (1)
- # code-reviews (3)
- # community-development (2)
- # conjure (10)
- # data-science (1)
- # datomic (15)
- # depstar (2)
- # docker (2)
- # etaoin (1)
- # events (1)
- # exercism (5)
- # fulcro (23)
- # helix (23)
- # introduce-yourself (4)
- # jobs (6)
- # kaocha (1)
- # lsp (11)
- # meander (107)
- # off-topic (8)
- # pathom (3)
- # polylith (33)
- # re-frame (23)
- # reagent (7)
- # reitit (28)
- # remote-jobs (3)
- # sci (1)
- # shadow-cljs (2)
- # specter (5)
- # sql (38)
- # tools-deps (72)
- # web-security (9)
- # xtdb (32)
Hey all, I'm getting a warning about not having a :key prop in a list, but I put a :key prop in a div iterated over by an map-indexed... what could I be missing?
@rdonahue Are you putting your key in the right place?
;; This one works
[:div.item-bar-list
(for [item items]
^{:key react-key}
[item-row item])]
;; This one does NOT work
[:div.item-bar-list
(for [item items]
[item-row {:key react-key} item])]
My code looks like this:
(defn person-list-phone []
(let [_ nil]
[:<>
[:div.patient-list [:h1 "Patients"]
[person-list-filters]
(map-indexed person-list-iterator (person-list/filter-people))
]]))
then a fn that conj's the index back into the map
(defn person-list-iterator [index person]
(let [p (nth person 1)
p2 (conj p {:index index})]
(person-list-item-phone p2)
))
Then finally the template for the item
(defn person-list-item-phone [p] etc.
I'm assuming I need to annotate the iterator?