Answer the question
In order to leave comments, you need to log in
Why am I getting [object Object] instead of data?
changeCategory = (e) => {
const cardCars = document.querySelector('.card-cars');
console.log(e.target.id);
const filteredCotegory = this.state.cars
.filter((car) => e.target.id === car.category)
.map((car, index) => {
console.log(car);
return (
<Car
key={index}
title={car.title}
category={car.category}
image={car.image}
money={car.money}
checkCar={this.checkCarModalHandler}
data-category={car.category}
/>
);
});
cardCars.innerHTML = filteredCotegory;
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question