Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Created September 14, 2017 04:46
Show Gist options
  • Save ShMcK/5ee8cd89a451f1e12d64926c4eff79cc to your computer and use it in GitHub Desktop.
Save ShMcK/5ee8cd89a451f1e12d64926c4eff79cc to your computer and use it in GitHub Desktop.

Button.js

import { connect, actions } from 'mirrorx'

const Button = ({value, handleClick}) => (
  <button onClick={handleClick}>
    {value}
  </button>
)

Button.propTypes = {
  value: Proptypes.String.isRequired
}

const mapToProps = (state, { id }) => ({,
  handleClick: () => actions.cart.doStuff(id)
})

const ConnectedButton = connect(mapToProps)(Button)

export {
  Button,
  ConnectedButton
}

// <ConnectedButton id={123} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment