-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better docs for integrating with jQuery et al #971
Comments
Mention the Reconciliation page to understand when an element is removed/added vs updated: http://facebook.github.io/react/docs/reconciliation.html |
FWIW, here's roughly the code that was causing me a problem: Widget = React.createClass({
render: function () {
var open = null;
if (this.props.showOpen) {
open = <a data-toggle="tooltip" title="do it">!</a>;
}
return (
<div class="widget"> ...
{open}
</div>
);
},
componentDidMount: function () {
$(this.getDOMNode()).find("*[data-toggle=tooltip]").tooltip();
}
}); I think my mistaken theory was that Also I eventually found the Bootstrap example in the repository, but it wasn't linked up from anywhere. In addition to the modal example, an example like a tooltip would be nice, because tooltips don't "own" the element, they are a kind of annotation on an existing element. |
Hey @ianb - I think that this is because the tooltip component doesn't change its behavior when the underlying DOM is manipulated. What happens if you do this instead? Widget = React.createClass({
render: function () {
var open = null;
if (this.props.showOpen) {
open = <a data-toggle="tooltip" title="do it">!</a>;
}
return (
<div class="widget"> ...
{open}
</div>
);
},
componentDidMount: function () {
this.runTooltipPlugin();
},
componentDidUpdate: function(prevProps) {
// You can remove this condition if you don't care how often the
// plugin is called
if (prevProps.showOpen !== this.props.showOpen) {
this.runTooltipPlugin();
}
},
runTooltipPlugin: function() {
$(this.getDOMNode()).find("*[data-toggle=tooltip]").tooltip();
}
}); |
Still plans on doing this anytime soon? I think we probably want to do a more complete revamp and reconsider some of our docs, maybe in the 1.0 timeframe. |
We should do it, but keeping a bunch of old issues around doesn't help visibility. |
Apparently the docs aren't too clear on this: https://plus.google.com/+IanBicking/posts/D1W2yqRh3BB
We need to have a section in the docs that talks about how to integrate with third party plugins in more detail, and stress the difference between mounting and updating.
The text was updated successfully, but these errors were encountered: