Fork me on GitHub
#reagent
<
2015-11-14
>
grav12:11:27

@richiardiandrea: as I understand it, you’d have to invent your own method. It’s explained a bit here: https://github.com/reagent-project/reagent/issues/5#issuecomment-32457550,

grav12:11:57

So the child has to be a component itself, and it can then call its parent with itself, when it’s mounted.

grav12:11:38

It’s a bit of a hassle, but then again, it allows for some optimizations as the author explains, and it’s usually not necessary to have a whole lot of refs.

grav12:11:10

I have only used refs when wrapping other libraries such as Open Layers. In that case I just had a single <div ref=‘map'> in my render anyways, so I could just use (r/dom-node this) instead.

grav12:11:26

In another case, we had a login component which read the values of username and password input fields directly from the DOM (which I consider a bit of an anti-pattern in React). I replaced that with callback functions that just updated the component state.