Skip to content

Instantly share code, notes, and snippets.

@appwebtech
Last active March 13, 2019 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appwebtech/4da96ea2203896ab27b6b32b084e04fb to your computer and use it in GitHub Desktop.
Save appwebtech/4da96ea2203896ab27b6b32b084e04fb to your computer and use it in GitHub Desktop.
// source https://jsbin.com
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
const MyApp = ((props) => {
const element = (
React.createElement("div", null,
React.createElement("h1", null, "Hey Virtual DOM?"),
React.createElement("h3", null, "Ive been rendered ", props, " times!")
)
)
ReactDOM.render(
element,
document.getElementById('app')
)
});
var numTimes = 0
setInterval(() => {
numTimes += 1
MyApp(numTimes)
}, 1000)
</script>
// Under chrome dev tools, make sure "Paint Flashing" is selected under rendering for the BG color to flash.
<script id="jsbin-source-javascript" type="text/javascript">const MyApp = ((props) => {
const element = (
<div>
<h1>Hey Virtual DOM?</h1>
<h3>Ive been rendered {props} times!</h3>
</div>
)
ReactDOM.render(
element,
document.getElementById('app')
)
});
var numTimes = 0
setInterval(() => {
numTimes += 1
MyApp(numTimes)
}, 1000)</script></body>
</html>
const MyApp = ((props) => {
const element = (
React.createElement("div", null,
React.createElement("h1", null, "Hey Virtual DOM?"),
React.createElement("h3", null, "Ive been rendered ", props, " times!")
)
)
ReactDOM.render(
element,
document.getElementById('app')
)
});
var numTimes = 0
setInterval(() => {
numTimes += 1
MyApp(numTimes)
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment