Created
January 31, 2016 01:03
-
-
Save chrisirhc/b80fe6a9c66b167c82d9 to your computer and use it in GitHub Desktop.
DOM diffing, DOM shape, and mouse events (First version)
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
class HasTooltip extends React.Component { | |
/* … */ | |
_renderPlaceholder() { | |
return ( | |
<div className="has-tooltip" | |
onMouseEnter={this._setHovered} | |
onMouseLeave={this._setNotHovered} | |
></div> | |
); | |
} | |
render() { | |
const placeholder = this._renderPlaceholder(); | |
const {isHovered} = this.state; | |
return isHovered ? ( | |
<div className="tooltip-region"> | |
{ placeholder } | |
<div>Hello</div> | |
</div> | |
) : placeholder; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment