Skip to content

Instantly share code, notes, and snippets.

@mattiamanzati
Last active October 5, 2016 10:16
Show Gist options
  • Select an option

  • Save mattiamanzati/76ea9c266ce7bd08cd81054b05545148 to your computer and use it in GitHub Desktop.

Select an option

Save mattiamanzati/76ea9c266ce7bd08cd81054b05545148 to your computer and use it in GitHub Desktop.
import {connect as reduxConnect} from 'react-redux'
export const connect = (mapStateToProps = defaultMapStateToProps, reduxMapDispatch, reduxMergeProps, options) =>
BaseComponent => {
const reduxMapState = (state, props) =>
mapStateToProps(props.selector(state), props, state)
const ReduxComponent = reduxConnect(
reduxMapState,
reduxMapDispatch,
reduxMergeProps,
options
)(BaseComponent)
return withLocalSelector(ReduxComponent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment