This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-25
Channels
- # aws (1)
- # beginners (60)
- # boot (12)
- # cider (7)
- # cljs-dev (8)
- # cljsrn (24)
- # clojure (169)
- # clojure-nl (1)
- # clojure-russia (3)
- # clojure-spec (15)
- # clojure-switzerland (1)
- # clojure-uk (24)
- # clojurescript (120)
- # core-async (9)
- # datomic (3)
- # emacs (2)
- # gsoc (3)
- # klipse (2)
- # leiningen (4)
- # numerical-computing (13)
- # off-topic (95)
- # om (7)
- # onyx (1)
- # powderkeg (2)
- # protorepl (2)
- # re-frame (6)
- # reagent (58)
- # ring-swagger (1)
- # rum (28)
- # untangled (42)
- # vim (6)
I have this reagent component that uses setInterval to change its state:
I can see the value being printed, a different one each time, but the html doesn't change. Why is that?
what would make the component re-render?
O, fuuu, it's an atom not a ratom.
@pupeno common gotcha 😉 https://presumably.de/reagent-mysteries-part-2-reloading.html
Yeah yeah... I know about this, I've been using reagent long enough... I just had a brain fart.
it's a common enough issue (especially because reagent docs (used to?) encourage referring r/atom
as atom
)
sorry if this has been answered in other places, but how do I remove react-dom-server
from my build? (I assume it's not needed if I'm not server-rendering)
@rgdelato I think it shouldn't be included by default
it's packaged as a separate cljsjs maven coordinate
if it's a transitive dep, try lein deps :tree
or boot show --deps
to see where the dependency comes from
in which case you can use excludes for that dependency (or global excludes) to remove it from the build
lein deps :tree
gives me this:
[reagent "0.6.0"]
[cljsjs/react-dom-server "15.2.1-0"]
[cljsjs/react-dom "15.2.1-0"]
[cljsjs/react "15.2.1-0"]
ah, I did not know that reagent defaults to including react-dom-server
:dependencies [[reagent "0.6.0" :exclusions [cljsjs/react-dom-server]]
should do the trick
hmm. adding the exclusion to 0.6.0
is making the build fail for me, but upgrading to 0.6.1
seems to remove react-dom-server
from the minified build by default. weird o.o
If I have a value that's been created by reagent/adapt-react-class, is a there a way to get to the backing react object?
How do I add a property to a reagent component?
I'm trying to use react-bootstrap with bootstrap 4.0.0 (from webjars) with reagent. It seems that cljsjs.react-bootstrap is pulling the 3.3.6-1 version of bootstrap. Can I use it with bootstrap 4.0.0?
or what would be the recommended way to use bootstrap 4.0.0?
[cljsjs/react-bootstrap "0.30.7-0" :exclusions [[cljsjs/react]]]
[cljsjs/bootstrap "3.3.6-1"]
[cljsjs/jquery "1.9.1-0"]
^ that's what I mean by it pulling the 3.3.6-1 version of bootstrap. I'm not sure where that dependency is specified though
@pupeno what are you trying to accomplish?
nvm, I figured it out.
I'd still be interested in what you found
@ballpark what do you need react-bootstrap for?
bootstrap works fine a pure css, unless you use the (relatively few) components that have a javascript component
in all other cases a react wrapper really only adds confusion
[:div.form-group [:input.form-input]]
or whatever is pretty clear already
@pesterhazy give me a sec to commit and push and I'll show you.
@pesterhazy Thanks for your reply. I was trying to do a dropdown in the navbar, which I'm pretty sure needs the js component. However, I'm pretty new to cljs development, so if people are getting by well without using the js components of bootstrap, I can do my best to avoid it.
yeah the dropdown is one of the components that needs it
this might be relevant? https://github.com/arackaf/simple-react-bootstrap
haven't tried it with cljs though
cool! I'll take a look.
if it's just the dropdown, it might be possible to re-implement it in cljs easily
anyway you can specify a global exclusion for bootstrap
side question: If someone were to really want the js components to react bootstrap, would it make sense to try to generate the externs for it?
cljsjs has one: https://github.com/cljsjs/packages/blob/master/react-bootstrap/resources/cljsjs/react-bootstrap/common/react-bootstrap.ext.js
that's the one that seems to be depending on the 3.3.6-1 version of bootstrap
@ballpark doesn't your exclusions line have a pair of []
too many?
that came from lein deps :tree
ahh sorry
you should be able to specify the exclusion, there must be a typo in your project.clj I think
ahh interesting
also see https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L82
I ended up downgrading to bootstrap 3 cause I really wanted those js components. Thanks again for your help!
@pesterhazy this is what I was doing: https://github.com/dashmantech/reagent-toolbox/blob/master/src/cljs/reagent_toolbox/core.cljs#L206
I just have the structure with the reagent component and the properties in a vector, so, it was easy modify the properties in the vector.
This is what I was trying to make work: https://github.com/dashmantech/reagent-toolbox-docs/blob/dev/src/cljs/reagent_toolbox_docs/components/radio_buttons.cljs#L23-L34
interesting, thanks for sharing
so the problem is about identifying and manipulating children?
I can see how that could become hairy
@pesterhazy and here you can see it in action: http://reagent-toolbox-docs.dashman.tech/radio-buttons