react-redux-delay
v1.3.9
Published
Throttle redux state updates.
Downloads
11
Maintainers
Readme
(a part of restate project)
Just delay update propagation. Or debounce. Or Throttle. Why not?
Sometimes store could update rapidly. Much more often than you need. Known solution
to mitigate the problem is named batching
.
For example - redux-batched-subscribe - redux store enhancer to "batch" updates. It just delays the notification of "subscribed" to redux elements, react-redux for example.
Redux-delay is doing absolutely the same, but from react
side.
All the elements and their descendants, wrapped by ReduxDelay will receive redux store updates in batched, or, to be more concrete - debounced way.
import reduxDelay, { ReduxDelay } from 'react-redux-delay';
const ThrottledComponent = reduxDelay(16 /* 60 "FPS" */, 'throttle')(BaseComponent);
const App = () => (
<ReduxDelay timeout={200} mode="debounce">
<RestOfApplication />
</ReduxDelay>
);
Supported modes - 'debounce', or 'throttle'.
Licence
MIT