react-dragscroll
react-dragscroll copied to clipboard
React 16.3 Compatibility; slight performance improvements
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
getDerivedStateFromPropsmethod. This replacescomponentWillReceiveProps.
Thanks for maintaining this library!
@qiaolb any chance you can merge this?