About the refs, I've been using a small helper: h.ref(this, 'some-element.children-element'); and its companion h.$ref(this, 'some-element.children..'); for the jquery version. I don't have a strict rule of when using it, but sometimes it's cleaner than having lots of nested callback on an inner children.. I.e. I can just do: h.$ref(this, 'header.search.input').. Which basically transforms to this.refs.header.refs.se…
React v0.14 Beta 1 released
61–62 of 62 posts
Re: React v0.14 Beta 1 released
#62About the refs, I've been using a small helper: h.ref(this, 'some-element.children-element'); and its companion h.$ref(this, 'some-element.children..'); for the jquery version. I don't have a strict rule of when using it, but sometimes it's cleaner than having lots of nested callback on an inner children.. I.e. I can just do: h.$ref(this, 'header.search.input').. Which basically transforms to this.refs.header.refs.se…
I wouldn't encourage doing that because it breaks encapsulation of your children. Like state, you shouldn't peer into another component's refs. But that should continue to work fine.
Let's say you have a "SearchComponent" with a "SearchButtonComponent" and "SearchInputComponent", I'm okay with using the strategy I suggested because using "SearchInputComponent" without its parent somewhere else in the code would be too risky so the encapsulation is still kept between parent/children.