Convert Shade to mapDispatchToProps

This commit is contained in:
Jordan Eldredge 2017-01-09 21:42:46 -08:00
parent 3dc8c0b58f
commit f1e993005b

View file

@ -3,20 +3,10 @@ import {connect} from 'react-redux';
import {TOGGLE_SHADE_MODE} from '../actionTypes';
class Shade extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.props.dispatch({type: TOGGLE_SHADE_MODE});
}
render() {
return <div
id='shade'
onClick={this.handleClick}
/>;
}
}
const Shade = (props) => <div id='shade' onClick={props.handleClick} />;
module.exports = connect()(Shade);
const mapDispatchToProps = (dispatch) => ({
handleClick: dispatch({type: TOGGLE_SHADE_MODE})
});
module.exports = connect(() => {}, mapDispatchToProps)(Shade);