0
我需要將父函數傳遞給子組件,但由於該組件是在地圖函數中生成的,因此它似乎不起作用。以下是有問題的代碼:ReactJS將父函數傳遞給使用地圖創建的子代
{this.state.recipes.map(function(a,index){
return (<Recipe name={a.name} ingredients={a.ingredients} index={index} onClick={this.handleDelete}/>);
}
解決此問題的最佳方法是什麼?