This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-19
Channels
- # admin-announcements (2)
- # beginners (25)
- # boot (93)
- # cider (2)
- # clara (2)
- # cljs-dev (63)
- # cljsjs (3)
- # cljsrn (38)
- # clojure (142)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-czech (1)
- # clojure-dev (7)
- # clojure-greece (1)
- # clojure-russia (170)
- # clojure-spec (11)
- # clojure-uk (65)
- # clojurescript (46)
- # clojurex (1)
- # code-reviews (3)
- # cursive (11)
- # datomic (35)
- # euroclojure (6)
- # events (2)
- # flambo (2)
- # hoplon (115)
- # instaparse (11)
- # jobs (21)
- # jobs-rus (3)
- # lambdaisland (2)
- # off-topic (17)
- # om (35)
- # onyx (161)
- # planck (1)
- # protorepl (7)
- # random (1)
- # re-frame (31)
- # reagent (19)
- # ring-swagger (21)
- # rum (5)
- # spacemacs (3)
- # specter (25)
- # test-check (20)
- # testing (7)
- # untangled (2)
- # yada (50)
@escherize you can’t use psuedo selectors in inline styles in css. You could have an on-focus handler change the styles passed to the element
(or define a class in CSS and put it on the element :)
One of these days it would be good to have a reagent equivalent of Radium https://github.com/FormidableLabs/radium
@mikethompson do you have an understanding about how radium works? (i.e. how it installs styles etc?)
I'm thinking just having a map with styles and inserting them is straightforward but it gets interesting when you start installing styles dynamically as components using them appear etc
Don't know how it works.
My wild guess is: 1. It appends its own <style> to body on statup 2. When asked to create a new class dynamically, it hashes it, and compares to all the ones it has previously created. 3. If the hash matches anything previous, it just returns that class name (because it already exists, no need to add it again) 4. If hash does not match anything previously created, then it makes up a new class name, and adds necessary definition to the <style> (see step 1) and returns a class name.
Something like that 🙂
I have a reagent component that takes a value argument, filters
: (defn foo [filters] …)
It needs to fetch data from an API that depends on filters
. So I make a GET request in :component-will-mount. Problem is, after the component is mounted, if the input value of filters changes, ~will-mount is not called.
I would expect the component to be remounted whenever its props change, but that is not the case. How should I ensure that my remote data is fetched whenever the input props to my component change?
no it's not re-mounted
you need to listen for :component-did-update
as well as to :component-did-mount
additionally, you could check if the props have changed (because it might also be component state, though that's not often used with reagent)
@petrus here's a quick gist: https://gist.github.com/pesterhazy/07fe0493dd7a2c15bac59464a6e8e853
found a bug, updated 🙂
Yeah, I ended up doing pretty much the same. I didn’t know about r/props tho
the canonical treatise on the subject: https://www.martinklepsch.org/posts/props-children-and-component-lifecycle-in-reagent.html