Skip to content

Instantly share code, notes, and snippets.

@heypoom
Last active September 3, 2018 10:34
Show Gist options
  • Save heypoom/9f239a5ced1739219aa18b8c1840df8e to your computer and use it in GitHub Desktop.
Save heypoom/9f239a5ced1739219aa18b8c1840df8e to your computer and use it in GitHub Desktop.
const createElement = React.createElement
React.createElement = (element, props, children, ...args) => {
// Fancy Logging for React Element Creation
const _props = props ? Object.entries(props).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(' ') : ''
console.log(`Creating %c<${element} %c${_props} %c/>`, 'color: teal; font-weight: bold', 'color: #777', 'color: teal')
// TODO: Monkey Patch your code here.
return createElement(element, props, children, ...args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment