Avoid useless renders (#3141)

* feat(eslint): Set react/jsx-no-bind: error

* refactor(notifications/setting_toggle): Do not use bind

* refactor(components/dropdown_menu): Do not use bind

* refactor(components/autosuggest_textarea): Do not use bind

* refactor(compose/privacy_dropdown): Do not use bind

* refactor(compose/upload_form): Do not use bind

* refactor(components/status): Do not use bind

* refactor(components/onboarding_modal): Do not use bind

* refactor: PR feedback

* chore(notifications/setting_toggle): Lint

* refactor: PR feedback
This commit is contained in:
Sorin Davidoi 2017-05-19 20:58:12 +02:00 committed by Eugen Rochko
parent 3da521a586
commit 1548695c83
8 changed files with 68 additions and 41 deletions

View file

@ -145,7 +145,8 @@ class AutosuggestTextarea extends ImmutablePureComponent {
}, 100);
}
onSuggestionClick (suggestion, e) {
onSuggestionClick (e) {
const suggestion = Number(e.currentTarget.getAttribute('data-index'));
e.preventDefault();
this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
this.textarea.focus();
@ -204,8 +205,9 @@ class AutosuggestTextarea extends ImmutablePureComponent {
role='button'
tabIndex='0'
key={suggestion}
data-index={suggestion}
className={`autosuggest-textarea__suggestions__item ${i === selectedSuggestion ? 'selected' : ''}`}
onClick={this.onSuggestionClick.bind(this, suggestion)}>
onClick={this.onSuggestionClick}>
<AutosuggestAccountContainer id={suggestion} />
</div>
))}