const handleAddToFavoriteBreed = (breed) => {
console.log(breed);
if (props.appReducer.favoriteBreeds.find(item =>
item.id ===
breed.id)
) {
Alert.alert(
'Warning!',
'This breed has already been added to your favorite list!',
[
{ text: 'OK' }
]
);
} else {
dispatch(setFavoriteBreeds(prev => [...prev, breed]));
console.log(props.appReducer.favoriteBreeds);
};
};
Привет! Подскажите пожалуйста почему почему выскакивает ошибка:
TypeError: props.appReducer.favoriteBreeds.find is not a function. (In 'props.appReducer.favoriteBreeds.find(function (item) {
return
item.id ===
breed.id;
})', 'props.appReducer.favoriteBreeds.find' is undefined)
???
в props.appReducer.favoriteBreeds изначально передан пустой массив