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:
parent
3da521a586
commit
1548695c83
8 changed files with 68 additions and 41 deletions
|
@ -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>
|
||||
))}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue