piranha / pump

Pump your REACTive app with fuel
Eclipse Public License 1.0
75 stars 5 forks source link

refs/children are not working #7

Open piranha opened 10 years ago

piranha commented 10 years ago
00:17 petehunt: piranha: https://github.com/facebook/react/blob/master/src/core/ReactComponent.js#L349
00:17 petehunt: that line and the one after it do props.ref, you should be able to only change those 2 places and it should work
00:18 piranha: petehunt: hmm... do you think I could do that externally somehow?
00:18 piranha: petehunt: to not break into React...
00:18 petehunt: piranha: heh, probably not
00:18 piranha: maybe with plugin somehow?
00:19 piranha: or monkeypatching... :))
00:19 petehunt: piranha: yeah, you could monkeypatch the method
00:19 piranha: I mean I would love to fix that, but I don't think you guys would appreciate my pull request, as it would be quite irrelevant to react's sources :)
00:19 piranha: petehunt: is there a good way to get to ReactComponent from outside? Or I have to hook in with modules somehow?
00:20 petehunt: piranha: i am not sure if we would take it (need to think about it more), but you could basically abstract props.ref to be like ReactRefs.getRef(component) and make ReactRefs injectable
00:20 piranha: hoho that would be good
00:20 petehunt: piranha: if you are using commonjs you can require it, otherwise i don't think so
00:20 piranha: 'children' thing is the same issue, just other way around - setting it
00:20 piranha: yeah, I'm using goog.require stuff unfortunately (it's what CLJS uses)
00:21 piranha: I need to learn how do you do those ReactRefs, though
00:21 petehunt: piranha: this could be relevant to stuff that i actually want to do (pooling props objects), but it's not high priority. if you could do it and do it in a way that doesn't change the code too much (like the one i suggested) it could be cool
00:21 petehunt: piranha: just look at ReactOwner.addComponentAsRefTo()
piranha commented 10 years ago

@petehunt following your idea with ReactRefs wasn't hard, but in the end I don't know how this can help me... though I certainly could do separate cljs-flavored build of React then...