Installation
yarn add react-redux-connect
Usage
Store all connect
options as a static attributes inside your component.
;; static { // if you need to map some data from store return // some data from state here ; } static { // if you need to dispatch some actions return actionOne actionTwo ; } static { // if you want to merge props manually return // ... } static connectOptions = // if you need to tweek some connect options // e.g. pure: false ; { // return something... } // and just pass your component to `connect` function// all settings will be taken from static propsMySmartComponent;
Example below is the same to following:
;; const mapStateToProps = { // if you need to map some data from store return // some data from state here ;}; const mapDispatchToProps = { // if you need to dispatch some actions return actionOne actionTwo ;}; const mergeProps = { // if you want to merge props manually return // ... }; const connectOptions = // if you need to tweek some connect options // e.g. pure: false; { // return something... } mapStateToProps mapDispatchToProps mergeProps connectOptionsMySmartComponent;
Licence
MIT
Testing
yarn test
Contributing
You are welcome! :)