This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-27
Channels
- # beginners (3)
- # boot (8)
- # cljs-dev (10)
- # clojure (87)
- # clojure-art (6)
- # clojure-dev (13)
- # clojure-japan (8)
- # clojure-russia (60)
- # clojure-sg (2)
- # clojurescript (126)
- # clojurewerkz (1)
- # core-logic (10)
- # cursive (6)
- # datomic (30)
- # editors (10)
- # ldnclj (7)
- # off-topic (114)
- # onyx (7)
- # re-frame (7)
- # reagent (37)
I want to add the :disabled
attribute only if the value in an atom is empty. In Hoplon, I can conditionally set attributes like this:
(button
:do-attr (cell= {:disabled (string/blank? cell-with-contents)})
"Get stuff")
How do I do this in Reagent?@ulsa you should be able to do more or less the same thing with reagent: [:button {:disabled (string/blank? @some-atom)} “Get stuff”]
@ulsa I find reagent mostly behaves the same for {:a nil} and {} in which case I write code like {:my-attr (when pred? “some value”)}
if not then (cond-> {} pred? (assoc :my-attr “some value”))
(cond-> {} pred? (assoc :my-attr “some value”))
yes, something like @colin.yates is suggesting would work well then
btw - you might want to take a look at re-frame if you like reagent
@ulsa yes, very similar intent.
BTW, depending on your requirements, as well as re-frame
, you might like re-com