1.1.0 • Published 5 years ago

redux-debouncer v1.1.0

Weekly downloads
125
License
ISC
Repository
github
Last release
5 years ago

Redux debouncer

Install

yarn add redux-debouncer

How to use

import { makeReduxDebouncer } from 'redux-debouncer'

/**
 * type: string,
 * interval:? number,
 * compare:? (currentAction: any, prevAction: any) => bool,
 */
const incrementDebounce = makeReduxDebouncer({ type: 'increment' })

const middleware = [
  /* your middleware */
  incrementDebounce
]

Example

  // debouncer for react navigator
  export const reactNavigationDebounce = makeReduxDebouncer({
    type: 'Navigation/NAVIGATE',
    compare: (current, prev) => current.routeName === prev.routeName,
  })