4 ms·
React really doesn't give you any way to handle communication between components besides going downwards, which is fine because that solves a lot of problems.
by nwienert 12y ago
React really doesn't give you any way to handle communication between components besides going downwards, which is fine because that solves a lot of problems.
You can very easily implement his 'subscribe' scenario in React. In fact, in 0.14 they are planning on having observe[0] to help you do just this.
Now, for my little plug. I've been working on Reapp since launch building a couple real-world apps and I agree that React needs an observe/subscribe model. In fact, I fell onto it while exploring a number of different patterns, and it's stuck the best.
We launched reapp-kit[1] (in beta) a few days ago. It unifies a router, immutable data, and a simple action system that lets you implement flux as well as sideways data loading almost no time. And it's all run through React's awesome contexts[2].
Here's a video of me writing a sideways actions in React, in seconds, using reapp-kit:
https://www.youtube.com/watch?v=FALQU-pVKJo https://www.youtube.com/watch?v=FALQU-pVKJo
[0] https://github.com/facebook/react/issues/3398 https://github.com/facebook/react/issues/3398
[1] https://github.com/reapp/reapp-kit https://github.com/reapp/reapp-kit
[2] https://www.tildedave.com/2014/11/15/introduction-to-contexts-in-react-js.html https://www.tildedave.com/2014/11/15/introduction-to-context...
- woah 12y agoReapp looked awesome, the issue is that the 'back-swipe' on my iPhone 5c was noticeably less smooth than the real thing... are you guys going to have to resort to some more exotic techniques to fix that?
- nwienert 12y agoAt launch that hadn't been optimized, which it has been quite a bit since then. We do need to optimize it further. It's actually React that is getting in the way here, but we don't want to cheat and break out of React because that would mean so pretty major disadvantages. We're thinking about building out either a separate animate() pipeline that works differently from render and just lets you use refs to animate things. Or, just optimizing further as there is some stuff we can do.