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(50)(VeryBigRenderComponent)
wait
The number of milliseconds to throttleoption
The option for lodash.throttlecomponent
The source React componentwrappedComponent
The throttled React component
MIT