-
Notifications
You must be signed in to change notification settings - Fork 329
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
Add connectFilter mixin #222
Conversation
Similar in usage to the `connect` mixin except it allows you to pass in a filterFunction to filter items from your store before they get passed on.
👍 |
Thanks! |
var PostView = React.createClass({ | ||
mixins: [Reflux.connectFilter(postStore,"post", function(posts) { | ||
posts.filter(function(post) { | ||
post.id === this.props.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am I wrong or are one or two return
statements missing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup... nice catch.
I've been having too much coffeescript lately to notice. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, that was my problem too.
On Mon, Feb 16, 2015 at 11:25 PM Mikael Brassman notifications@github.com
wrote:
In README.md
#222 (comment):@@ -501,6 +501,27 @@ var Status = React.createClass({
});+#### Using Reflux.connectFilter + +`Reflux.connectFilter` is used in a similar manner to `Reflux.connect`. Use the +`connectFilter` mixin when you want only a subset of the items in a store. A +blog written using Reflux would probably have a store with all posts in +it. For an individual post page, you could use `Reflux.connectFilter` to +filter the posts to the post that's being viewed. + +```javascript +var PostView = React.createClass({ + mixins: [Reflux.connectFilter(postStore,"post", function(posts) { + posts.filter(function(post) { + post.id === this.props.id;
Yup... nice catch.
I've been having too much coffeescript lately to notice. [image: 👍]
—
Reply to this email directly or view it on GitHub
https://github.com/spoike/refluxjs/pull/222/files#r24797357.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to be fixed now by #240
Similar in usage to the
connect
mixin except it allows you to pass ina filterFunction to filter items from your store before they get passed
on.