npm.io
1.3.9 • Published 8 years ago

react-redux-delay

Licence
MIT
Version
1.3.9
Deps
4
Size
15 kB
Vulns
0
Weekly
0
Stars
54

React-redux-delay


restate

Batching updates for the performance sake.

Build status

(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

Keywords