React Base Fiddle (JSX)

Starting point for creating JSFiddles with React.

by John Award

HTML

<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

Babel + JSX

class Hello extends React.Component {
  constructor(props) {
  	super(props);
    
    this.state = {
    	html: ''
    }
  
  }
  
  onInput(event) {
  	this.setState({
    	html: event.target.innerText.toUpperCase()	
    });
  
  }
  
  render() {
  	const style = {
    	backgroundColor: 'white',
    }
    return (
      <div>
        <div
          style={style}
          contentEditable
          className="editable"
          onInput={this.onInput.bind(this)}
          suppressContentEditableWarning
        >
          {this.state.html} 
        </div>
     </div>
    );
  }
}

ReactDOM.render(
  <Hello/>,
  document.getElementById('container')
);