Last active
May 28, 2018 14:08
-
-
Save kyuwoo-choi/ddb517065f3c8d3af3840d1dd795b494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Virtual DOM example | |
var tree = render(count); // We need an initial tree | |
var rootNode = createElement(tree); // Create an initial root DOM node ... | |
document.body.appendChild(rootNode); // ... and it should be in the document | |
setInterval(function () { | |
count++; | |
var newTree = render(count); | |
var patches = diff(tree, newTree); | |
rootNode = patch(rootNode, patches); | |
tree = newTree; | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jsx example | |
const element = ( | |
<div> | |
<h1>Hello!</h1> | |
<h2>Good to see you here.</h2> | |
</div> | |
); | |
render(element); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment