React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/react-with-addons.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
JavaScript 1.7
var MyRadioButton = React.createClass({
handleChange: function () {
this.props.onChange(this.props.myValue)
},
render: function () {
return (
<input type="radio" onChange={this.handleChange}>{this.props.myValue}</input>
)
}
});
var MyApp = React.createClass({
getInitialState: function () {
return {
selectedValue: ''
}
},
changeValue: function (newValue) {
this.setState({selectedValue: newValue })
},
render: function () {
return (
<div>
<MyRadioButton onChange={this.changeValue} myValue="A" />
<MyRadioButton onChange={this.changeValue} myValue="B" /><br></br>
</div>
)
}
});
React.render(<MyApp />, document.getElementById('container'));