Skip to content

Instantly share code, notes, and snippets.

@gabmontes
Created November 16, 2016 15:27
Show Gist options
  • Select an option

  • Save gabmontes/c84df01d834ca20076fcaaa36ff85b70 to your computer and use it in GitHub Desktop.

Select an option

Save gabmontes/c84df01d834ca20076fcaaa36ff85b70 to your computer and use it in GitHub Desktop.
A minimal (re)implementation of ReactDOM for learning and teaching purposes.
/**
* not-react
*
* A minimal (re)implementation of ReactDOM for learning and teaching purposes.
*
* https://medium.com/@gab_montes/react-in-200-bytes-28156e714165
*/
// eslint-disable-next-line no-extra-semi
;(function (global) {
global.notReactDOM = {
render: function (component, element) {
element.innerHTML = typeof component === 'function'
? component()
: component
}
}
})(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment