[examples] Use refs instead of findDOMNode
Paul O’Shannessy committed
Sep 24, 2015 at 15:03 UTC
3c0f46e3da6b81245e717f2458691d46374378d8
1 file changed
+5
-6
examples/jquery-bootstrap/js/app.js
+5
-6
@@ -18,17 +18,16 @@ var BootstrapModal = React.createClass({
18
// integrate Bootstrap or jQuery with the components lifecycle methods.
19
componentDidMount: function() {
20
// When the component is added, turn it into a modal
21
- $(ReactDOM.findDOMNode(this))
22
- .modal({backdrop: 'static', keyboard: false, show: false});
21
+ $(this.refs.root).modal({backdrop: 'static', keyboard: false, show: false});
22
},
23
componentWillUnmount: function() {
25
- $(ReactDOM.findDOMNode(this)).off('hidden', this.handleHidden);
24
+ $(this.refs.root).off('hidden', this.handleHidden);
25
},
26
close: function() {
28
- $(ReactDOM.findDOMNode(this)).modal('hide');
27
+ $(this.refs.root).modal('hide');
28
},
29
open: function() {
31
- $(ReactDOM.findDOMNode(this)).modal('show');
30
+ $(this.refs.root).modal('show');
31
},
32
render: function() {
33
var confirmButton = null;
@@ -52,7 +51,7 @@ var BootstrapModal = React.createClass({
51
}
52
53
return (
55
- <div className="modal fade">
54
+ <div className="modal fade" ref="root">
55
<div className="modal-dialog">
56
<div className="modal-content">
57
<div className="modal-header">