I'm working on a group of divs that expand a specific div on hover, my problem is when I hover on an element all the divs is affected.
I dont know why its happening,
Hope you understand me.
Thanks
constructor(props) {
super(props);
this.state = {
isHovered: false
};
this.handleMenuHover = this.handleMenuHover.bind(this);
}
handleMenuHover() {
this.setState({
isHovered: !this.state.isHovered
});
}
render() {
const menuActive = this.state.isHovered ? "active" : "";
return (
<div className="slider-menu">
<div
className={"menu " + menuActive}
onMouseEnter={this.handleMenuHover}
onMouseLeave={this.handleMenuHover}
>
a
</div>
<div
className={"menu " + menuActive}
onMouseEnter={this.handleMenuHover}
onMouseLeave={this.handleMenuHover}
>
b
</div>
<div
className={"menu " + menuActive}
onMouseEnter={this.handleMenuHover}
onMouseLeave={this.handleMenuHover}
>
c
</div>
<div
className={"menu " + menuActive}
onMouseEnter={this.handleMenuHover}
onMouseLeave={this.handleMenuHover}
>
d
</div>
</div>
);
}