Skip to content

Instantly share code, notes, and snippets.

@mdamien
Created February 5, 2016 03:45
Show Gist options
  • Select an option

  • Save mdamien/1f9d4071c6662ed4ccfd to your computer and use it in GitHub Desktop.

Select an option

Save mdamien/1f9d4071c6662ed4ccfd to your computer and use it in GitHub Desktop.
React simple bootstrap tooltip
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