Created
June 22, 2018 04:07
-
-
Save ManasJayanth/0c6bd034227d5204f33e80d1ce13e11e to your computer and use it in GitHub Desktop.
Snippets for Learn you some custom react renderers
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 DOMRenderer = ReactReconciler(hostConfig); | |
let internalContainerStructure; | |
export default { | |
render(elements, containerNode, callback) { | |
// We must do this only once | |
if (!internalContainerStructure) { | |
internalContainerStructure = DOMRenderer.createContainer( | |
containerNode, | |
false, | |
false | |
); | |
} | |
DOMRenderer.updateContainer(elements, internalContainerStructure, null, callback); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment