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

Sharing state from root to all nested components #95

Closed
alvinfrancis opened this issue Aug 22, 2016 · 4 comments
Closed

Sharing state from root to all nested components #95

alvinfrancis opened this issue Aug 22, 2016 · 4 comments

Comments

@alvinfrancis
Copy link

In Om, mounting the component root with om/root also allows for supplying shared state which can then be accessed by any component under the root component via om/get-shared. This allows for global data and services to be set without resorting to global state since all state is still local to the mounted component tree. This allows, for example, multiple mounts of the same app on the same page with "global" data and services independent from each other.

Would it be possible to include something similar to rum? Or are there any suggested patterns to get the same result?

@ghost
Copy link

ghost commented Aug 22, 2016

Or are there any suggested patterns to get the same result?

React's context feature solves that problem, although i don't have an example of using it from Rum.

@martinklepsch
Copy link
Contributor

My derivatives library linked in the Rum Readme exports some of its
functionality via component context if you are curious.
On Mon, 22 Aug 2016 at 10:31, Alejandro Gómez notifications@github.com
wrote:

Or are there any suggested patterns to get the same result?

React's context https://facebook.github.io/react/docs/context.html
feature solves that problem, although i don't have an example of using it
from Rum.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#95 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAF82C0PqL5Q1yV720zAJu_RWxi_Kwluks5qiV51gaJpZM4JpnWz
.

@ghost
Copy link

ghost commented Aug 22, 2016

Here is the relevant source code. Didn't know about derivatives, cool project!

@alvinfrancis
Copy link
Author

Thanks for all the help guys. Looks like context is exactly what I need. I can build my abstractions over that. Thanks for linking that source as well. I'll be studying it.

Closing this issue.

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