Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-async-action

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-async-action

wrapper for redux-actions createAction function for better work with redux-promise-middleware

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

create-async-action

wrapper for redux-actions createAction function for better work with redux-promise-middleware

When using redux-actions and redux-promise-middleware together its annoying to do something like this:

const myAction = createAction('MY_ACTION', async () => {
  ...
});

const reducer = handleActions({
  [myAction + '_SUCCESS']: () => ...
  [myAction + '_ERROR']: () => ...
  [myAction + '_LOADING']: () => ...
}, { ... })

Instead of this you can do something like this:

import createAsyncAction from 'create-async-action';

const myAction = createAsyncAction('MY_ACTION', async () => {
  // the same code as before
});

const reducer = handleActions({
  [myAction.success]: () => ...
  [myAction.error]: () => ...
  [myAction.loading]: () => ...
}, { ... })

Yes, here I use custom suffixes for redux-promise-middleware.

Thanks for inspiring, matpaul

Keywords

FAQs

Package last updated on 16 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc