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/react-with-addons.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<script src="https://rawgit.com/react-bootstrap/react-bootstrap-bower/master/react-bootstrap.min.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
JavaScript 1.7
var DropdownButton = ReactBootstrap.DropdownButton;
var MenuItem = ReactBootstrap.MenuItem;
var Hello = React.createClass ({
getInitialState() {
return { key: null }
},
onSelect(key) {
this.setState({ key: key });
},
render() {
var selected = this.state.key ? <p>Selected: {this.state.key}</p> : '';
return (<div>
<DropdownButton bsStyle="primary" title="Test" onSelect={this.onSelect}>
<MenuItem eventKey='1' active={this.state.key==='1'}>Action</MenuItem>
<MenuItem eventKey='2' active={this.state.key==='2'}>Another action</MenuItem>
<MenuItem eventKey='3' active={this.state.key==='3'}>Active Item</MenuItem>
<MenuItem divider />
<MenuItem divider />
<MenuItem eventKey='4' active={this.state.key==='4'}>Separated link</MenuItem>
</DropdownButton>
{selected}
</div>);
}
});
React.render(<Hello/>, document.getElementById('container'));