use constructor bound methods for logo

This commit is contained in:
Jake McDermott 2019-01-03 11:56:42 -05:00
parent 5948ecce16
commit e5cdea8daf
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7

View File

@ -12,18 +12,26 @@ class TowerLogo extends Component {
super(props);
this.state = { hover: false };
this.onClick = this.onClick.bind(this);
this.onHover = this.onHover.bind(this);
}
onClick = () => {
const { history } = this.props;
history.push('/');
};
onClick () {
const { history, onClick: handleClick } = this.props;
onHover = () => {
if (!handleClick) return;
history.push('/');
handleClick();
}
onHover () {
const { hover } = this.state;
this.setState({ hover: !hover });
};
}
render () {
const { hover } = this.state;