Skip to content

Instantly share code, notes, and snippets.

@agenthunt
Last active December 21, 2020 19:39
Show Gist options
  • Save agenthunt/d1c7027365995079a815aed4ca52ecc3 to your computer and use it in GitHub Desktop.
Save agenthunt/d1c7027365995079a815aed4ca52ecc3 to your computer and use it in GitHub Desktop.
hello-react-custom-renderer-render-function
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