Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy

codeaholicguy/if.jsx

Created Jan 19, 2016
Embed
What would you like to do?
// ternary operator
<div>
{ enabled ? <p>Enabled</p> : null }
</div>
// if/else outside of JSX
let node = null;
if (enabled) {
node = <p>Enabled</p>;
}
<div>{ node }</div>
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.