Fork me on GitHub

@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


has there been any work in that direction?


@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 🙂

Petrus Theron11:08:16

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)


found a bug, updated 🙂

Petrus Theron12:08:16

Yeah, I ended up doing pretty much the same. I didn’t know about r/props tho