React Base Fiddle (JSX)

Starting point for creating JSFiddles with React. This uses React with Addons.

by lustoykov

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://npmcdn.com/react-dom@latest/dist/react-dom.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>

JavaScript 1.7

var tableColumns = [
    { 'title': 'Title', 'prop': 'Title' },
    { 'title': 'Ranking', 'prop': 'Rating' },
    { 'title': 'Price', 'prop': 'CurPrice' }
  ];

    var destination = document.querySelector("#container");
    var Buildrules = React.createClass({

  		/*var renderCheckbox = function(val, row) {
  			return React.createElement('input',{type: 'checkbox', defaultChecked: false,classname: 'rowCheckBox'});
  		};

  		var masterCheckbox = function(val, row) {
  			return React.createElement('input',{type: 'checkbox', defaultChecked: false});
  		};*/

      getInitialState: function() {
            return {data: {}};
          },

      loadData: function(){


      },

  componentWillMount: function(){
    $.ajax({
      url: 'https://www.omdbapi.com/?s=star&r=json&plot=short',
      success: function(data){
        this.setState({data: data});
      }.bind(this)
    })

  },
  componentDidMount:function(){

  },
  	render:function(){
       
       const searches = this.state.data.Search ? this.state.data.Search.map( (searchResult, index) => <h1 key={index}> {searchResult.Title} </h1>) : ""
        console.log(searches);
      return (
      <div>
      		<h1>{this.state.data.totalResults}</h1>
       		{ searches }
			</div>
  			);
      }
  });

    ReactDOM.render(
      <div id="blah">
        <Buildrules col = {tableColumns} />
      </div>,
      destination
    );