redux-thunk-catch
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Redux Thunk with catch support

A redux thunk alternative with error handling support.

Install:

npm i --save redux-thunk-catch

Usage

Import Note: You are importing a function, that creates thunk middleware, not the thunk middleware itself.

import createThunk from 'redux-thunk-catch';

Create a error reporting function

const reportError = (err, state, action, dispatch) => {
  crashReporter.capture(err, {
    state,
    action
  });
}

Pass error reporting function to createThunk

const thunk = createThunk(reportError)

Now thunk can be used as any other middleware, using applyMiddleware(). You can read the documentation for thunk for its detailed usage.

/redux-thunk-catch/

    Package Sidebar

    Install

    npm i redux-thunk-catch

    Weekly Downloads

    69

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • shoaib.kalsekar