这个看得有点懵,
可能要结合其它实例看。
html
React JS Example React.js Example
js
var data = [{ "when": "2 minutes ago", "who": "Jill Dupre", "description": "Created new account" }, { "when": "1 hour ago", "who": "Lose White", "description": "Added fist chapter"}];var headings = ['When', 'Who', 'Description'];var Heading = React.createClass({ render: function() { return { this.props.heading}; }});var Headings = React.createClass({ render: function() { var headings = this.props.headings.map(function(name) { return; }); return {headings}; }});var Row = React.createClass({ render: function() { return { this.props.changeSet.when} { this.props.changeSet.who} { this.props.changeSet.description} ; }});var Rows = React.createClass({ render: function() { var rows = this.props.changeSets.map(function(changeSet) { return( ); }); return {rows}; }});var App = React.createClass({ render: function() { return
; }});ReactDOM.render(
, document.getElementById('container'));