Skip to content

Instantly share code, notes, and snippets.

@dandean
Created March 5, 2016 04:30
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 dandean/4018528327f5177e1c36 to your computer and use it in GitHub Desktop.
Save dandean/4018528327f5177e1c36 to your computer and use it in GitHub Desktop.
let i = 0;
class UsesConditional extends React.Component {
render() {
i++;
return (
<div>
<Conditional if={i % 2}>
<span>Show Me</span>
</Conditional>
</div>
)
}
}
ReactDOM.render(
<UsesConditional />,
document.getElementById('container')
);
let i = 0;
class UsesTernary extends React.Component {
render() {
i++;
return (
<div>
{
i % 2 ?
<span>Show Me</span> :
null
}
</div>
)
}
}
ReactDOM.render(
<UsesTernary />,
document.getElementById('container')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment