mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[examples] Use ReactDOM for appropriate APIs
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Example with Click Counter</title>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -23,7 +24,8 @@
|
||||
return (<h2 onClick={this.handleClick}>Click me! Number of clicks: {this.state.clickCount}</h2>);
|
||||
}
|
||||
});
|
||||
React.render(<Counter />,
|
||||
ReactDOM.render(
|
||||
<Counter />,
|
||||
document.getElementById('message')
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -12,7 +12,7 @@ var ExampleApplication = React.createClass({
|
||||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script type="text/babel" src="example.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script type="text/babel">
|
||||
class ExampleApplication extends React.Component {
|
||||
@@ -38,7 +39,7 @@
|
||||
}
|
||||
var start = new Date().getTime();
|
||||
setInterval(() => {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ var ExampleApplication = React.createClass({
|
||||
var start = new Date().getTime();
|
||||
|
||||
setInterval(function() {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@ babel example.js --out-dir=build</pre>
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="build/example.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script type="text/babel">
|
||||
var ExampleApplication = React.createClass({
|
||||
@@ -38,7 +39,7 @@
|
||||
});
|
||||
var start = new Date().getTime();
|
||||
setInterval(function() {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<ExampleApplication elapsed={new Date().getTime() - start} />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script>
|
||||
var ExampleApplication = React.createClass({
|
||||
render: function() {
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
var start = new Date().getTime();
|
||||
setInterval(function() {
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
ExampleApplicationFactory({elapsed: new Date().getTime() - start}),
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<body>
|
||||
<div id="jqueryexample"></div>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js" charset="utf-8"></script>
|
||||
|
||||
Vendored
+5
-5
@@ -18,17 +18,17 @@ var BootstrapModal = React.createClass({
|
||||
// integrate Bootstrap or jQuery with the components lifecycle methods.
|
||||
componentDidMount: function() {
|
||||
// When the component is added, turn it into a modal
|
||||
$(React.findDOMNode(this))
|
||||
$(ReactDOM.findDOMNode(this))
|
||||
.modal({backdrop: 'static', keyboard: false, show: false});
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
$(React.findDOMNode(this)).off('hidden', this.handleHidden);
|
||||
$(ReactDOM.findDOMNode(this)).off('hidden', this.handleHidden);
|
||||
},
|
||||
close: function() {
|
||||
$(React.findDOMNode(this)).modal('hide');
|
||||
$(ReactDOM.findDOMNode(this)).modal('hide');
|
||||
},
|
||||
open: function() {
|
||||
$(React.findDOMNode(this)).modal('show');
|
||||
$(ReactDOM.findDOMNode(this)).modal('show');
|
||||
},
|
||||
render: function() {
|
||||
var confirmButton = null;
|
||||
@@ -124,4 +124,4 @@ var Example = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
React.render(<Example />, document.getElementById('jqueryexample'));
|
||||
ReactDOM.render(<Example />, document.getElementById('jqueryexample'));
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.5/jquery.mobile.min.js"></script>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Vendored
+1
-1
@@ -188,4 +188,4 @@ var PagePopUpContent = React.createClass({
|
||||
PagePopUpContent = React.createFactory(PagePopUpContent);
|
||||
|
||||
// Render application.
|
||||
React.render(App(null), document.getElementById('content'));
|
||||
ReactDOM.render(App(null), document.getElementById('content'));
|
||||
|
||||
@@ -53,7 +53,7 @@ var QuadraticCalculator = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<QuadraticCalculator />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script type="text/babel" src="example.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
||||
</p>
|
||||
<script src="../../build/react-with-addons.js"></script>
|
||||
<script src="../../build/react-dom.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
|
||||
<script type="text/babel">
|
||||
var CSSTransitionGroup = React.addons.CSSTransitionGroup;
|
||||
@@ -69,7 +70,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<AnimateDemo />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user