Redux middleware for reporting actions to third party APIs. This package is extremely useful for analytics and error handling. Can be used with various APIs such as New Relic, Sentry, Adobe DTM, Keen
Installation
npm install --save redux-reporter
Usage
General Reporting
Create your reporting middleware
// /middleware/myReporter.jsimport reporter from'redux-reporter';exportdefaultreporter(({ type, payload }, getState) => {try {// report to external API } catch (err) {}});
Attach meta data to your actions
// /actions/MyActions.jsexportfunctionmyAction() {let type ='MY_ACTION';return { type, meta: { report: { // default attribute that is selected by redux-reporter type, payload:'example payload' } } };}