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 Keyboard = React.createClass({
    componentDidMount: function () {
        let context = new (window.AudioContext || window.webkitAudioContext)();
        let oscillator = context.createOscillator();
        let gain = context.createGain();
    
        oscillator.type = 'sine';
        oscillator.frequency.value = 3000;
        gain.gain.value = 0.5;
    
        oscillator.connect(gain);
        gain.connect(context.destination);
    
        this.setState({
            context: context,
            oscillator: oscillator,
            gain: gain
        });
    },
    
    render: function() {
        return (
            <div id="keyboard"
                 onKeyDown={this.playNote}
                 onKeyUp={this.stopNote}>
            </div>
        );
    }
});
 
React.render(<Keyboard />, document.getElementById('container'));