react-redux-delay
TypeScript icon, indicating that this package has built-in type declarations

1.3.9 • Public • Published

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

Package Sidebar

Install

npm i react-redux-delay

Weekly Downloads

5

Version

1.3.9

License

MIT

Unpacked Size

15 kB

Total Files

6

Last publish

Collaborators

  • kashey