Created
October 15, 2015 15:42
-
-
Save hironow/bd482da2bd87d8248969 to your computer and use it in GitHub Desktop.
React edge 4.2
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello React!</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
</head> | |
<body> | |
<div id="container"> | |
<!-- This element's contents will be replaced with your component. --> | |
</div> | |
<script type="text/babel" src="main.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
var CountryDropdown = React.createClass({ | |
getInitialState: function() { | |
return { | |
showOptions: false | |
}; | |
}, | |
render: function() { | |
var options; | |
if (this.state.showOptions) { | |
options = <countryoptions></countryoptions>; | |
} | |
return ( | |
<div className="dropdown" onClick={this.handleClick}> | |
<label>国を選択してください</label> | |
{options} | |
</div> | |
); | |
}, | |
handleClick: function() { | |
this.setState({ showOptions: true }); | |
} | |
}); | |
ReactDOM.render( | |
<CountryDropdown />, | |
document.getElementById('container') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment