Last active
January 31, 2016 00:39
-
-
Save chrisirhc/903b00425f2bc500e2f6 to your computer and use it in GitHub Desktop.
DOM diffing, DOM shape, and mouse events (Best practice)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Best practice, to maintain a similar DOM shape | |
render() { | |
const {isHovered} = this.state; | |
return ( | |
<div className={classNames(isHovered && 'tooltip-region')} | |
onMouseEnter={this._setHovered} | |
onMouseLeave={this._setNotHovered}> | |
<div className="has-tooltip"></div> | |
{isHovered && <div>Hello</div>} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment