Skip to content

Instantly share code, notes, and snippets.

@chrisvfritz
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisvfritz/dfe6ac8345887c88d82e to your computer and use it in GitHub Desktop.
Save chrisvfritz/dfe6ac8345887c88d82e to your computer and use it in GitHub Desktop.
window.$ = (element, propsOrChildren, childrenIfProps) ->
if (propsOrChildren? and propsOrChildren instanceof Array) or not (propsOrChildren instanceof Object)
props = null
children = propsOrChildren
else
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