我收到一個錯誤Cannot read property 'handleDeleteAll' of undefined
。 這是我的代碼:無法訪問兒童組件行動
const RecipeList = (props) => {
const Items = props.recipes.map((recipe) => {
return <RecipeListItem key={recipe.id} recipe={recipe} />
});
console.log(props);
return (
<div>
<button onClick={this.props.handleDeleteAll}>Remove All</button>
<div>
{Items}
</div>
</div>
)
}
export default RecipeList;
這是回購:https://github.com/kstulgys/fcc-recipe-box/blob/master/src/components/RecipeList.js
太容易了。非常感謝! – karolis2017