admin管理员组文章数量:1023744
I have tried to follow the bootstrap documentation to make work a popover. But I have been unsuccessful in converting this piece of code into something React can understand.
{
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});
}
Without it my popover cannot function properly. What's the solution?
I have tried to follow the bootstrap documentation to make work a popover. But I have been unsuccessful in converting this piece of code into something React can understand.
{
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});
}
Without it my popover cannot function properly. What's the solution?
Share Improve this question asked Jul 23, 2018 at 20:07 Roy SalibaRoy Saliba 531 silver badge5 bronze badges 2- Checkout reactstrap: reactstrap.github.io/ponents/popovers – Pop-A-Stash Commented Jul 23, 2018 at 20:11
- Or React-Bootstrap react-bootstrap.github.io/ponents/popovers – lsimonetti Commented Jul 23, 2018 at 20:20
2 Answers
Reset to default 3Also you can do that too, if you define jquery in index.html. Call jquery from window object.
ponentDidMount() {
window.$('[data-toggle="popover"]').popover();
}
It make sense to use react-bootstrap
library but if you still want a solution go ahead and follow this...
You need to understand react lifecycle methods instead of using document.ready
callback function.
try adding this to your react ponent
ponentDidMount() {
$('[data-toggle="popover"]').popover();
}
Make sure you import jquery top of the file
import $ from 'jquery'
I have tried to follow the bootstrap documentation to make work a popover. But I have been unsuccessful in converting this piece of code into something React can understand.
{
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});
}
Without it my popover cannot function properly. What's the solution?
I have tried to follow the bootstrap documentation to make work a popover. But I have been unsuccessful in converting this piece of code into something React can understand.
{
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});
}
Without it my popover cannot function properly. What's the solution?
Share Improve this question asked Jul 23, 2018 at 20:07 Roy SalibaRoy Saliba 531 silver badge5 bronze badges 2- Checkout reactstrap: reactstrap.github.io/ponents/popovers – Pop-A-Stash Commented Jul 23, 2018 at 20:11
- Or React-Bootstrap react-bootstrap.github.io/ponents/popovers – lsimonetti Commented Jul 23, 2018 at 20:20
2 Answers
Reset to default 3Also you can do that too, if you define jquery in index.html. Call jquery from window object.
ponentDidMount() {
window.$('[data-toggle="popover"]').popover();
}
It make sense to use react-bootstrap
library but if you still want a solution go ahead and follow this...
You need to understand react lifecycle methods instead of using document.ready
callback function.
try adding this to your react ponent
ponentDidMount() {
$('[data-toggle="popover"]').popover();
}
Make sure you import jquery top of the file
import $ from 'jquery'
本文标签: javascriptHow to use bootstrap popover with reactjsStack Overflow
版权声明:本文标题:javascript - How to use bootstrap popover with reactjs - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745574032a2156907.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论