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

Best place to put Subscriptions and Fetchings on Redux? #8

Open
SenerDemiral opened this issue Sep 5, 2015 · 4 comments
Open

Best place to put Subscriptions and Fetchings on Redux? #8

SenerDemiral opened this issue Sep 5, 2015 · 4 comments

Comments

@SenerDemiral
Copy link

No description provided.

@AdamBrodzinski
Copy link
Owner

Do you mean where to put the subscribe call or the data that gets returned in mini-mongo? I presume the former, if not let me know.

I like to put the subscriptions in the topmost component of a feature... for example subscribe to the chats data in ChatsContainer and in this container use connect to get the data from state. The only other thing ChatsContainer does is render one child, Chats and it sends it's properties down to it. This makes it like a view-controller that only handles data. This makes Chats really easy to test and debug.

Here's an example of this method:
https://github.com/AdamBrodzinski/meteor-flux-leaderboard/blob/redux/client/components/AppContainer.jsx#L7

@SenerDemiral
Copy link
Author

Place of Subscription OK.
But where to put trackCollection?

@AdamBrodzinski
Copy link
Owner

Ah, I've been putting trackCollection a line after defining the collection so it's easy to find/notice. It can really go anywhere as long as the collection is defined, but putting it close makes it easy for me to find.

Cheers
Adam

@SenerDemiral
Copy link
Author

Thanks Adam,
Subscription place is important, if subscribed then tracked anyway.

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