Skip to content

Instantly share code, notes, and snippets.

@craftzdog
Last active March 10, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craftzdog/6f3fe670ce6bdc2a43106cb2be8a2be1 to your computer and use it in GitHub Desktop.
Save craftzdog/6f3fe670ce6bdc2a43106cb2be8a2be1 to your computer and use it in GitHub Desktop.
// @flow
import { type HOC } from 'recompose'
import { connect } from 'react-redux'
import type { Dispatch, State } from '../types'
type F<M> = (state: State) => M
type CHOC<E: {}, M> = HOC<{ ...$Exact<E>, dispatch: Dispatch, ...M }, E>
export default function connectStore<Enhanced: {}, M: *>(
mapper: F<M>
): CHOC<Enhanced, M> {
return (connect(mapper): Function)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment