0
我有下面的代碼,它什麼都不渲染,我不知道我的錯誤在哪裏,我沒有看到控制檯中的任何錯誤。反應圖es6箭頭功能不起作用
var App = React.createClass({
getInitialState(){
return {
items:[1,2,3]
}
},
renderItem(){
this.state.items.map((item,i)=> <li key={i}>{item}</li>)
},
render(){
return(
<ul>
{this.renderItem}
</ul>
)
}
})
React.render(<App />, document.getElementById('container'));
需要提醒。
當你使用返回並再次調用它?但它的工作,謝謝!有沒有renderItem的自執行函數? –
如果這是正確的答案,請單擊左側答案旁邊的空白複選標記以將其標記爲正確。 –
我又被卡住了Andy http://stackoverflow.com/questions/39865363/pass-index-from-function-to-function-in-react –