我試圖遍歷一個對象,並創建錶行動態地下面陣營的觀點是不會呈現在陣營0.14
var msg = React.createClass({
render: function() {
var profiles = [];
$.map(profs, function(prof){
profiles.push(<tr>
<td>{prof.Name}</td>
<td>{prof.Type}</td>
</tr>)
陣營0.14像,並嘗試在添加此
<table>
<tbody>
{profiles}
</tbody>
</table>
但它是沒有渲染和也沒有拋出任何錯誤也。 我喜歡渲染
ReactDOM.render(React.createElement(msg, {data: this.model.attributes}), this.el);
如果我刪除「{profiles}
」它是正確渲染頁面的其他部分。 但是,如果使用相同的代碼在陣營0.13.2與
React.render(React.createElement(msg, {data: this.model.attributes}), this.el);
這是工作的罰款。 如果有人爲這類錯誤提出調試工具,它會更有幫助。
除非我失去了一些東西,這看起來好了,你的錯誤可能是由於一些我們看不到這裏。偏離主題似乎你不明白每個地圖和地圖之間的區別,因爲你每個人都使用它,你也可以使用es5的地圖 –
只是一個觀察:你爲什麼不分配'$ .map'的輸出?函數到'profiles'變量? 'var profiles = $ .map(profs,function(prof){return(
我也試過這種方式..但它是一樣的 –