1
我想在reactjs的HTML表格中顯示一些數據。但我不斷收到 錯誤未捕獲TypeError:無法讀取未定義的屬性'__reactAutoBindMap'。我無法弄清楚我的代碼有什麼問題。React Uncaught TypeError:無法讀取未定義的屬性'__reactAutoBindMap'
<!DOCTYPE html>
<html>
<head>
<title>React Flux</title>
<script src="https://fb.me/react-0.13.3.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body>
<div id="component" style="color:red"></div>
<script type="text/jsx">
//
// create component
//
var Table = React.createClass({
render: function render() {
var _self = this;
var thead = React.DOM.thead({},
React.DOM.tr({},
this.props.cols.map(function (col) {
return React.DOM.th({}, col);
})));
var tbody = this.props.rows.map(function (row) {
return React.DOM.tr({},
_self.props.cols.map(function (col) {
return React.DOM.td({}, row[col] || "");
}));
});
return React.DOM.table({}, [thead, tbody]);
}
});
var container = document.querySelector("#container");
var tableModel = {
cols: ["Name", "Age"],
rows: [{
"Name": "Chase",
"Age": "27"
}],
}
React.render(Table(tableModel), container);
</script>
</body>
</html>