Skip to content

Instantly share code, notes, and snippets.

@cedricdelpoux
Created September 16, 2015 09:01
Show Gist options
  • Save cedricdelpoux/9603520d248224c1e2cc to your computer and use it in GitHub Desktop.
Save cedricdelpoux/9603520d248224c1e2cc to your computer and use it in GitHub Desktop.
Switch statements in Jsx
render() {
const { name } = this.props
return (
<div>
{ (() => {
switch (nane) {
case 'toto': return <span>Toto</span>
case 'tata': return <span>Tata</span>
case 'titi': return <span>Titi</span>
}
})() }
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment