Add key to fix reagent warning
This commit is contained in:
parent
081809d4cd
commit
5c2f429d2e
1 changed files with 7 additions and 7 deletions
|
|
@ -50,20 +50,20 @@
|
||||||
|
|
||||||
(defn main []
|
(defn main []
|
||||||
(let [{:keys [frame rects]} @state
|
(let [{:keys [frame rects]} @state
|
||||||
sorted (pack-rects-naive frame rects)]
|
sorted (map-indexed vector (pack-rects-naive frame rects))]
|
||||||
[:main
|
[:main
|
||||||
[:h1 "Visualization"]
|
[:h1 "Visualization"]
|
||||||
[:svg {:viewBox "-1 -1 501 501" :xmlns "http://www.w3.org/2000/svg"}
|
[:svg {:viewBox "-1 -1 501 501" :xmlns "http://www.w3.org/2000/svg"}
|
||||||
[:rect {:width (geom/width frame)
|
[:rect {:width (geom/width frame)
|
||||||
:height (geom/height frame)}]
|
:height (geom/height frame)}]
|
||||||
(for [rect sorted]
|
(for [[idx rect] sorted]
|
||||||
[:rect {:width (geom/width rect) :height (geom/height rect)
|
^{:key idx} [:rect {:width (geom/width rect) :height (geom/height rect)
|
||||||
:x (-> rect :p :x)
|
:x (-> rect :p :x)
|
||||||
:y (-> rect :p :y)}])]
|
:y (-> rect :p :y)}])]
|
||||||
[:h2 "Rectangles"]
|
[:h2 "Rectangles"]
|
||||||
[:ul
|
[:ul
|
||||||
(for [rect sorted]
|
(for [[idx rect] sorted]
|
||||||
[:li [:pre (pr-str rect)]])]]))
|
^{:key idx} [:li [:pre (pr-str rect)]])]]))
|
||||||
|
|
||||||
(defn ^:dev/after-load init []
|
(defn ^:dev/after-load init []
|
||||||
(println "Initializing…")
|
(println "Initializing…")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue