React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by santoshpatro
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.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>
CSS
recentChangesTable {
background-color: 'FloralWhite', font-size: '19px'
}
JavaScript 1.7
var RecentChangesTable = React.createClass({
render: function() {
return ( <div>
<h1>Recent Changes </h1>
< table className = 'table' > {
this.props.children
} < /table></div>);
}
});
RecentChangesTable.Heading = React.createClass({
render: function() {
var headingStyle = {
backgroundColor: 'FloralWhite',
fontSize: '19px'
};
return <th style = {
headingStyle
} > {
this.props.heading
} < /th>;
}
});
RecentChangesTable.Headings = React.createClass({
render: function() {
var headings = this.props.headings.map(function(name,index) {
return <RecentChangesTable.Heading key={index} heading = {
name
}
/>
});
return <thead > < tr > {
headings
} < /tr></thead >
}
});
RecentChangesTable.Row = React.createClass({
render: function() {
var trStyle = {
backgroundColor: 'aliceblue'
}
return <tr style = {
trStyle
} >
< td > {
this.props.changeSet.when
} < /td> < td > {
this.props.changeSet.who
} < /td> < td > {
this.props.changeSet.description
} < /td> < /tr >
}
});
RecentChangesTable.Rows = React.createClass({
render: function() {
var rows = this.props.changeSets.map(function(changeSet,index) {
return ( < RecentChangesTable.Row key={index} changeSet = {
changeSet
}
/>);
});
return ( < tbody > {
rows
} < /tbody>)
}
});
var App = React.createClass({
getDefaultProps:function(){
return {
headings:['When happened','Who did it','What they change']
};
},
render: function() {
return ( < RecentChangesTable >
< RecentChangesTable.Headings headings = {
this.props.headings
}
/> <...