I can render 1 component but is there another way to render others components depending what am I hovering?
constructor(props) {
super(props)
this.handleMouseHover = this.handleMouseHover.bind(this)
this.state={
isHovering: false
}
}
handleMouseHover(){
this.setState(this.toggleHoverState)
}
toggleHoverState(state) {
return {
isHovering:!state.isHovering
}
}
<a href="#" onMouseEnter={this.handleMouseHover} onMouseLeave={this.handleMouseHover}>Hover me1</a>
<a href="#" onMouseEnter={this.handleMouseHover} onMouseLeave={this.handleMouseHover}>Hover me2</a>
{isHovering && (<Component/>)}