Last active
August 13, 2019 19:53
-
-
Save Tevinthuku/f4608548dad9d400f9a3b6289711cccd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function reconcile(parentDom, instance, element) { | |
/** code... */ | |
else if (instance.element.type === element.type) { | |
// perform props update here | |
updateDomProperties(instance.dom, instance.element.props, element.props); | |
instance.childInstances = reconcileChildren(instance, element); | |
instance.element = element; | |
return instance; | |
} | |
/** code... */ | |
} | |
function instantiate(element) { | |
const { type, props } = element; | |
/** code... */ | |
const dom = isTextElement | |
? document.createTextNode("") | |
: document.createElement(type); | |
// apply new props and provide empty object as a prevObject since this is instanciation | |
updateDomProperties(dom, {}, props); | |
/** code... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment