From 8c635446a3d5ca5b98677357e6551ded5b03c425 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 29 Dec 2016 21:59:49 -0800 Subject: [PATCH] Convert Shuffle to mapDispatchToProps --- js/components/Shuffle.jsx | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/js/components/Shuffle.jsx b/js/components/Shuffle.jsx index b208df6b..d723374c 100644 --- a/js/components/Shuffle.jsx +++ b/js/components/Shuffle.jsx @@ -3,21 +3,15 @@ import {connect} from 'react-redux'; import classnames from 'classnames'; -class Shuffle extends React.Component { - constructor(props) { - super(props); - this.handleClick = this.handleClick.bind(this); - } - handleClick() { - this.props.dispatch({type: 'TOGGLE_SHUFFLE'}); - } - render() { - return
; - } -} - -module.exports = connect((state) => state.media)(Shuffle); +const Shuffle = ({shuffle, toggleShuffle}) => ( +
+); +const mapStateToProps = (state) => state.media; +const mapDispatchToProps = (dispatch) => ({ + toggleShuffle: () => dispatch({type: 'TOGGLE_SHUFFLE'}) +}); +module.exports = connect(mapStateToProps, mapDispatchToProps)(Shuffle);