Created
February 5, 2016 03:45
-
-
Save mdamien/1f9d4071c6662ed4ccfd to your computer and use it in GitHub Desktop.
React simple bootstrap tooltip
This file contains hidden or 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
| var UITooltip = React.createClass({ | |
| propTypes: { | |
| title: React.PropTypes.string.isRequired, | |
| }, | |
| render() { | |
| return <span ref='container'>{this.props.children}</span>; | |
| }, | |
| componentDidMount() { | |
| var container = React.findDOMNode(this.refs.container); | |
| $(container).tooltip({ | |
| title: this.props.title, | |
| container: 'body', | |
| }); | |
| }, | |
| componentWillUnmount() { | |
| var container = React.findDOMNode(this.refs.container); | |
| $(container).tooltip('destroy'); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment