-
Notifications
You must be signed in to change notification settings - Fork 1.2k
rx HOC idea #178
Comments
What's the advantage over |
In most cases is simple performance I think. Transforming frequently changing prop to observable will allow to avoid rerenders of main component. Also for a long lists, for example you have 1000 points and want to support fast controllable hover on them (controllable here means that we receive hoveredPointId as external prop). Just as some easy helper to start using rx partially. As |
The problem with putting observables inside a component's render method, like this <div><Subscribe>{name$}</Subscribe></div> is that people will be tempted to apply transformations inside the render method: <div><Subscribe>{name$.map(formatName)}</Subscribe></div> This means a new observable will be created on each render, which means the It's impossible to make this mistake with |
Also, all the benefits you cite are currently possible with |
I see, thank you, just started to heavily use |
The question is, could you (or anybody who read this) share some real heavy examples with |
Yes ;-) too simple |
I would like to see some heavy examples, too 😄 |
Honestly, most of my uses of it are about that simple. Another thing I commonly use it for is to fetch data based on a prop using a promise and |
Just found this project react-observable-subscribe and got some idea about recompose HOC. Not sure it is a good idea but.
<Suscribe>
also can be written to suport attributes on inner componentsThe text was updated successfully, but these errors were encountered: