Socket
Socket
Sign inDemoInstall

redux-bind-action-groups

Package Overview
Dependencies
6
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redux-bind-action-groups

bind redux action creators function to group


Version published
Weekly downloads
26
decreased by-61.19%
Maintainers
1
Install size
2.12 MB
Created
Weekly downloads
 

Readme

Source

bind redux action to group, avoid action generate function name conflict, and compatibility redux bindActionCreators

Build Status

install

npm i -S redux-bind-action-groups

example

my two action creator files

// post.js
export function getList(){
    return {
        type: 'POST_GETLIST'
    }
}


// photo.js
export function getList(){
    return {
        type: 'PHOTO_GETLIST'
    }
}

bind action creator with redux bindActionCreators

import * as postActions from './post';
import * as photoActions from './photo';
import {bindActionCreators} from 'redux';

function mapDispatchToProps(dispatch){
    return bindActionCreators({
        ...postActions,
        ...photoActions
    }, dispatch)
}

// in React Component
this.props.getList();  // which getList will exec in post and photo

useage

import bindActionGroups from 'redux-bind-action-groups';

function mapDispatchToProps(dispatch){
    return bindActionGroups({
        post: postActions,
        photo: photoActions,
        foo: () => ({type: 'DO_SOMETHING'})
    }, dispatch)
}

// in React Component, work fine
this.props.post.getList();
this.props.photo.getList();
this.props.foo()

Keywords

FAQs

Last updated on 17 May 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc