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

Add a search bar to filter components #91

Merged
merged 2 commits into from Apr 11, 2016
Merged

Add a search bar to filter components #91

merged 2 commits into from Apr 11, 2016

Conversation

roonyh
Copy link
Contributor

@roonyh roonyh commented Apr 11, 2016

No description provided.

placeholder="Filter"
name="filter-text"
value={this.state.filterText}
onChange={this.filterStoryList.bind(this)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accept these events via props in the component you create as mentioned above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this.filterStoryList=this.filterStoryList.bind(this) in the constructor . Here it will create a different listener on every re-render.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that's fine for specially this kind of apps since we won't render items in often. (Often means few times a sec)

And js.bind is pretty fast and React does a lot more costly stuff for virtual DOM diffing.

@roonyh roonyh force-pushed the search-bar branch 2 times, most recently from 3a71383 to 572e685 Compare April 11, 2016 12:07
@@ -0,0 +1,73 @@
import React from 'react';

export default class FilterText extends React.Component {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always use a noun for the Class name. TextFilter would be a better name.
And make sure file name matches that too. (text_filter.js)

@arunoda arunoda merged commit 15fa7fa into master Apr 11, 2016
@arunoda arunoda deleted the search-bar branch April 11, 2016 13:24
@arunoda
Copy link
Member

arunoda commented Apr 11, 2016

Thanks @roonyh

@shilman shilman added the misc label May 27, 2017
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

Successfully merging this pull request may close these issues.

None yet

4 participants