Bind Navicon toggleMenu in mapDispatchToProps

This commit is contained in:
Ken-Håvard Lieng 2017-05-06 23:04:20 +02:00
parent cbe3b95d8c
commit a753efd1dd

View File

@ -3,13 +3,11 @@ import { connect } from 'react-redux';
import { toggleMenu } from '../actions/ui'; import { toggleMenu } from '../actions/ui';
class Navicon extends PureComponent { class Navicon extends PureComponent {
handleClick = () => this.props.dispatch(toggleMenu());
render() { render() {
return ( return (
<i className="icon-menu navicon" onClick={this.handleClick} /> <i className="icon-menu navicon" onClick={this.props.toggleMenu} />
); );
} }
} }
export default connect()(Navicon); export default connect(null, { toggleMenu })(Navicon);