react-dragscroll icon indicating copy to clipboard operation
react-dragscroll copied to clipboard

React 16.3 Compatibility; slight performance improvements

Open lsadam0 opened this issue 7 years ago • 1 comments

Hello qiaolb,

This PR:

  • Removes string ref usage and introduces compatibility with React 16.3
  • Moves method binding from the render body into the constructor, this helps to avoid unnecessary re-renders
  • Only computes container style when the height or width props have changed. This also helps to avoid unnecessary rerenders
  • When the height and width props have changed, the recalculation of container style is handled by react 16.3's new getDerivedStateFromProps method. This replaces componentWillReceiveProps.

Thanks for maintaining this library!

lsadam0 avatar Mar 30 '18 15:03 lsadam0

@qiaolb any chance you can merge this?

mylesthedev avatar Mar 11 '21 01:03 mylesthedev