Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Higher-order components #2

Open
hugooliveirad opened this issue May 11, 2015 · 1 comment
Open

Higher-order components #2

hugooliveirad opened this issue May 11, 2015 · 1 comment

Comments

@hugooliveirad
Copy link

Hey, nice library!

I think it would be awesome if RR provided some higher-order components to separate pure components from stateful components (ones with subscribe).

RRSubscribe

<RRSubscribe store={Store} render={function(data$) {
  return (<Component data$={data$} />);
}} />

Another higher-order component to enable a way to observe data would be great too, but I can't think how to implement it right now.

@zxbodya
Copy link

zxbodya commented Jun 17, 2015

Hi,

I have already done something similar - also started with mixin, than refactored it to higher-order component..

But, shortly after, I realised that it is not suitable server side rendering(doing isomorphic app) - since I need somehow to wait for data before rendering... Also this is a bit uncomfortable on client-side - since all data passed as observable should be considered optional or should have default value.

Than I tried to make observable react elements, and later switched to observable components.

It is almost beautiful:

  • it is isomorphic out of the box
  • observable components are compossible (just as any observables)
  • all view components can be pure components

Here is more details about it: https://gist.github.com/zxbodya/20c63681d45a049df3fc
And a project build using this approach: https://github.com/zxbodya/reactive-widgets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants