Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
window.$ = (element, propsOrChildren, childrenIfProps) ->
if (propsOrChildren? and propsOrChildren instanceof Array) or not (propsOrChildren instanceof Object)
props = null
children = propsOrChildren
props = propsOrChildren
children = childrenIfProps
React.createElement element, props, children
Object.keys(React.DOM).forEach (elementName) ->
window["$#{elementName}"] = (props, children) ->
$ elementName, props, children
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment