React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by f0084rrrr
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<!-- <script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script> -->
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
React
var MyDropdown = React.createClass({
getInitialState: function() {
return {
value: 'select'
}
},
change: function(event){
this.setState({value: event.target.value});
},
render: function(){
return(
<div>
<select id="fruit" onChange={this.change} value={this.state.value}>
<option value="select">Select</option>
<option value="Apples">Apples</option>
<option value="Mangoes">Mangoes</option>
</select>
<p></p>
<p>{this.state.value}</p>
</div>
);
}
});
ReactDOM.render(
<MyDropdown />,
document.getElementById('container')
);