Skip to content

Instantly share code, notes, and snippets.

@jjt
Created March 22, 2016 16:56
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 jjt/780b6044fc6610014311 to your computer and use it in GitHub Desktop.
Save jjt/780b6044fc6610014311 to your computer and use it in GitHub Desktop.
React Hyperscript vs JSX
h('div.example', [
h('h1#heading', 'This is hyperscript'),
h('h2', 'creating React.js markup'),
h(AnotherComponent, {foo: 'bar'}, [
h('li', [
h('a', {href: 'http://whatever.com'}, 'One list item')
]),
h('li', 'Another list item')
])
])
<div className="example">
<h1 id="heading">This is JSX</h1>
<h2>creating React.js markup</h2>
<AnotherComponent foo={bar}>
<li><a href="http://whatever.com">One list item</a></li>
<li>Another list item</li>
</AnotherComponent>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment