-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Conversation
placeholder="Filter" | ||
name="filter-text" | ||
value={this.state.filterText} | ||
onChange={this.filterStoryList.bind(this)} |
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.
Accept these events via props in the component you create as mentioned above.
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.
do this.filterStoryList=this.filterStoryList.bind(this)
in the constructor . Here it will create a different listener on every re-render.
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.
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.
3a71383
to
572e685
Compare
@@ -0,0 +1,73 @@ | |||
import React from 'react'; | |||
|
|||
export default class FilterText extends React.Component { |
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.
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
)
Thanks @roonyh |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 7a713d3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
No description provided.