Last active
August 4, 2016 06:36
-
-
Save ryardley/7230648e3815daa9a90794f8a4d9b98f to your computer and use it in GitHub Desktop.
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
const Switch = (props) => <span>{props.children}</span>; | |
const Case = (props) => props.expr && props.children; | |
function TestSwitch() { | |
const val = 3; | |
return ( | |
<Switch> | |
<Case expr={val === 1}> | |
<div>One</div> | |
</Case> | |
<Case expr={val === 2}> | |
<div>Two</div> | |
</Case> | |
<Case expr={val === 3}> | |
<div>Three</div> | |
</Case> | |
</Switch> | |
); | |
} | |
const elem = document.getElementById('thing'); | |
ReactDOM.render(<TestSwitch/>, elem) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment