mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-04 07:55:28 +00:00
Convert Shade to mapDispatchToProps
This commit is contained in:
parent
3dc8c0b58f
commit
f1e993005b
1 changed files with 6 additions and 16 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue