1.0.6 • Published 8 years ago

redux-map-bind-actioncreator v1.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

redux-smooth-bind-actioncreators

This implentation of connect / bindActionCreator is a quality of life change for my particular usage. I have more than 1 "store" and each of my pages needs to bind its own actions/states while also binding dispatch. I don't want to include the functions at the bottom of "n" number of pages setting up these connects/bindToActionCreators. So, just include this package and we should be good to go. You now have "actions", and "state", all wrapped up nicely for you and no need to have 2 small functions and includes (at top) on each page.

Please NOTE: This code assumes you have multiple reducers AND you either want to include all of these stores, or just a particular one(or many).

Simple Directions

Example In Practice

So, in your react class, you can now do 'actions.myFuncName()'. The dispatch is bound to it.

I want my whole state tree on my props. Do nothing, this handles it for you.

I want only 1 (or more) stores on my props. For instance, my "store/state tree" has

the following reducers. Shoes, Prices, Colors, Sizes. BUT, I only want my component to care about the state as it pertains to Shoes & Colors (remember, Shoes is its own reducer )

I want a custom "actions" name

Now, you see "actions", that is the default return on props. The example above, I assume you destructed it, ala:

But if you want to denote the 'actions' another way, just do this:

In Short:

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago