Last active
December 21, 2020 19:39
-
-
Save agenthunt/d1c7027365995079a815aed4ca52ecc3 to your computer and use it in GitHub Desktop.
hello-react-custom-renderer-render-function
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
import ReactReconciler from 'react-reconciler'; | |
const hostConfig = {}; | |
const ReactReconcilerInst = ReactReconciler(hostConfig); | |
export default { | |
render: (reactElement, domElement, callback) => { | |
console.log(arguments); | |
// Create a root Container if it doesnt exist | |
if (!domElement._rootContainer) { | |
domElement._rootContainer = ReactReconcilerInst.createContainer(domElement, false); | |
} | |
// update the root Container | |
return ReactReconcilerInst.updateContainer(reactElement, domElement._rootContainer, null, callback); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment