tommoor / emojione-picker

A react emoji picker for use with emojione
http://tommoor.github.io/emojione-picker
MIT License
261 stars 61 forks source link

Performance issues on `render()` #38

Closed omichelsen closed 7 years ago

omichelsen commented 8 years ago

I am using your lib inside my chat input component, which uses textarea onChange when user enters something to update the state. However this state change triggers EmojiPicker to render every time the user presses a key. Understandably this causes CPU use to go through the roof and input slows to a crawl.

Suggestion:

Add shouldComponentRender() handling using fx react-addons-shallow-compare:

shouldComponentUpdate(nextProps, nextState) {
  return shallowCompare(this, nextProps, nextState);
}
tommoor commented 7 years ago

Thanks for bringing this up, it should be much better in 2.0 - https://github.com/tommoor/emojione-picker/releases/tag/v2.0.0