Created
May 31, 2016 18:34
-
-
Save mrblueblue/0d427298b7f4d5d9ebdd16e059f2fb86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {compose, getContext, mapProps} from 'recompose' | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| return compose( | |
| getContext({ | |
| store: Proptypes.shape({ | |
| getState: Proptypes.func, | |
| dispatch: Proptypes.func, | |
| subscribe: Proptypes.func, | |
| }) | |
| }), | |
| mapProps(({store, ...rest}) => Object.assign( | |
| { }, | |
| {...rest}, | |
| mapStateToProps(store.getState(), {...rest}), | |
| mapDispatchToProps(store.dispatch, {...rest}) | |
| )) | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment