Created
September 16, 2015 09:01
-
-
Save cedricdelpoux/9603520d248224c1e2cc to your computer and use it in GitHub Desktop.
Switch statements in Jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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