Reputation: 2816
Am trying to incorporate a tooltip into React Js. However I'm not sure how to incorporate the $(function), even adding this to index.html doesn't make it work.
// where do I put this??
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
render() {
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
}
Upvotes: 0
Views: 788
Reputation: 1485
You can add it in ComponentDidMount which will be called immediately after your component mounted to the DOM.
ComponentDidMount(){
$('[data-toggle="tooltip"]').tooltip()
}
Upvotes: 1