Skip to content

Instantly share code, notes, and snippets.

@hawx hawx/jsx.js
Last active Aug 29, 2015

Embed
What would you like to do?
What JSX should be
// Given we have some,
// function el(name) { return function() { ... } }
var Dropdown = el('Dropdown'),
Menu = el('Menu'),
MenuItem = el('MenuItem');
var dropdown = Dropdown(
'A dropdown list',
Menu(
MenuItem('Do Something'),
MenuItem('Do Something Fun!'),
MenuItem('Do Something Else')));
render(dropdown);
// http://facebook.github.io/jsx/#why-not-template-literals
var Box = el('Box'),
Answer = el('Answer'),
BoxComment = el('Box.Comment');
var box = Box(
shouldShowAnswer(user)
? Answer({value: false}, 'no')
: BoxComment('Text Content'))
render(box);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.