JSPM

redux-thunk-catch

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q59345F
  • License MIT

Thunk middleware alternative for Redux, with error handling support.

Package Exports

  • redux-thunk-catch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (redux-thunk-catch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.