This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-17
Channels
- # adventofcode (76)
- # announcements (6)
- # beginners (103)
- # boot (28)
- # calva (128)
- # cider (48)
- # cljs-dev (40)
- # clojure (268)
- # clojure-austin (2)
- # clojure-dev (2)
- # clojure-europe (47)
- # clojure-italy (10)
- # clojure-nl (17)
- # clojure-spec (2)
- # clojure-uk (15)
- # clojurescript (45)
- # code-reviews (14)
- # cursive (5)
- # data-science (2)
- # datascript (1)
- # datomic (52)
- # duct (4)
- # emacs (2)
- # figwheel (1)
- # figwheel-main (4)
- # fulcro (13)
- # hyperfiddle (51)
- # leiningen (19)
- # nrepl (40)
- # off-topic (45)
- # pathom (3)
- # pedestal (28)
- # portkey (7)
- # re-frame (25)
- # reagent (76)
- # reitit (7)
- # shadow-cljs (92)
- # slack-help (3)
- # specter (5)
- # timbre (2)
- # tools-deps (39)
- # unrepl (1)
- # vim (13)
How can I pass an attribute to an html element like checked
here <input type="radio" name="sb" id="sb-2" checked>
?
I'm trying to create a reagent component from segmented-control here http://code.fstgerm.com/pure-css-segmented-controls/ and it requires checked
to be set on an element.
@gadfly361 anyway :checked true
does not work 🙂
I found out that it should be [:input {:checked "checked"}]
I tried uploading a screenshot but not sure if it landed (got a notice from slack saying not enough space). Anyways search for checkbox or boolean and you will find you exact example explained
@gadfly361 it has landed, I can see it. Yes, do remember that guide. But in reagent 0.8.1 that does not work :man-shrugging:
@ericnormand have you checked it recently? ☝️
@gadfly361 my only guess is that it does not work for "radio"
but works for "checkbox"
@achikin I have not checked that in a while
@gadfly361 for me {:checked true}
simply removes checked
completely...
what browser?
@ericnormand chromium Version 66.0.3328.0 (Developer Build) (64-bit)
My guess is something else is mucking it up if you are using chromium (perhaps a lein clean is needed or a hard page refresh)
trying it now ...
seems to work for me
@achikin do you mind sharing a small gist?
(defn home-page []
[:div
[:h2 "Welcome to Reagent"]
[:input {:type "radio" :checked true}]])
this is in Chrome
I also think this behavior is directly from React
it's not a reagent or hiccup thing
@ericnormand have you checked the page source?
yes, it renders checked but does not have the attribute
that's true
Moreover, {:checked "checked"}
also does not add checked
in a test example (but works on my actual app)
mine doesn't show checked in the inspector
but the css still picks up the :checked
attribute
does the styling work, @achikin?
and when I look at the page you linked with the components, the inspector shows the same thing
checked does not change as you click on elements
@ericnormand @gadfly361 the only difference I can spot between my real app and an example is that example uses reagent-provided react 16.3 and I'm using react 16.4 from npm
so in your code :checked true
still does not work, but :checked "checked"
does?
@ericnormand yes, right.
so it's all the way down to react
But it seems that http://code.fstgerm.com/pure-css-segmented-controls/ relies on it's presence and has some css selectors, that query for checked attr
that makes sense
so instead of true/false, you can use nil/"checked"
or you could switch the [checked]
selectors to :checked
selectors (??)
@ericnormand as soon as I copied the whole css into my resources - that'd be the best option, thank you!
you're welcome 👍
I am exploring a reactjs template that imports images using the ES6 syntax ( e.g : import logo from "../assets/img/logo.png"
, and after compiling the JSX into JS and importing it with shadow-cljs, the image is not being rendered. Has someone here had this experience before?
@mateus.pimentel.w this is dependent on how you compiled the JSX into JS
importing images is not standard JS, it’s implemented in a JS build tool like webpack
i will ask if it is possible to integrate webpack with shadow-cljs and still get optimized compilation
i’m surprised that not many people seems to use JSX with cljs. I mean, there are some people, but i tought that almost everybody would do it
@mateus.pimentel.w how or why would anyone want to use JSX? the syntax is downright horrific.