Throttle the number of times render()
is called.
It may enhance the performance under the following conditions.
- The component receives new props frequently.
- The component has a huge or slow
render()
.
npm i --save react-throttle-render
import throttle from 'react-throttle-render'
const ThrottledComponent = throttle(VeryBigRenderComponent, 50)
component
The source React componentwait
The number of milliseconds to throttlewrappedComponent
The throttled React componentoption
The option for lodash.throttle
MIT