This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-15
Channels
- # beginners (138)
- # bigdata (2)
- # boot (45)
- # cljsrn (29)
- # clojure (108)
- # clojure-austin (1)
- # clojure-gamedev (1)
- # clojure-korea (9)
- # clojure-russia (50)
- # clojure-spec (2)
- # clojure-uk (28)
- # clojurescript (40)
- # component (1)
- # cursive (35)
- # datomic (39)
- # dirac (16)
- # emacs (22)
- # flambo (11)
- # funcool (6)
- # hoplon (74)
- # leiningen (4)
- # off-topic (1)
- # om-next (2)
- # onyx (141)
- # planck (7)
- # proton (10)
- # protorepl (4)
- # re-frame (21)
- # reagent (13)
- # remote-jobs (1)
- # ring (3)
- # specter (9)
- # sql (3)
- # test-check (14)
- # untangled (1)
- # vim (9)
- # yada (16)
I'm trying to render an :option
element with :home/room
as the value, but only room
is rendered in the UI. Is this because reagent resolves keywords with (name :home/room)
whenever you try to use them as a visible value in the UI?
seems to be the case for [:div :elmer/hey]
too
only hey
is rendered
so I guess this is part of reagent's render functionality
hi. anyone know how to stop input to lose focus due to a re-rendering when you’re adding new elements to the parent (which also holds the key)?
Hi,
Sometimes I feel a bit limited by the fact that Reagent requires :key props when a sequence is produced. In some cases it really seems like the nicest way of doing some things is to use the sequence library to create certain patterns. For example, consider a sequence of "breadcrumbs" separated by a (font-awesome) arrow:
(interpose [:i {:class "fa fa-caret-right"}] (map (fn [crumb] [:span {:key crumb} crumb]) crumbs))
The above gives the Warning: Every element in a seq should have a unique :key:
warning (since the arrow icons don't have :key attributes), which is quite annoying and forces me to use less nice ways of solving the problem. Anyone else annoyed by/have a way to deal with this?
@curlyfry is a pure css solution possible? a selector like .crumb + .crumb
might work since your interposed element doesn't have any data
@curlyfry if you put your sequence into
a [:div]
then you will swerve the warning... it wouldn't be as performant for changes to a long sequence, but breadcrumbs are probably not going to be a very long sequence
@curlyfry, maybe you could use (gensym)
? Something like (interpose [:i {:key (str (gensym)) :class "fa fa-caret-right"}] (map (fn [crumb] [:span {:key crumb} crumb]) ["home" "profile"]))
doh, or maybe not … because I think gensym
will only get evaluated once 😅
@jjfine @mccraigmccraig @upgradingdave Thanks guys, will check it out tomorrow!