warning: render(...) React js?
index.js:1 Warning: render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render.
changeCategory = (e) => {
setTimeout(() => {
const filteredCars = this.state.cars
.filter((car) => e.target.id === car.category)
.map((car, index) => {
return (
<Car
key={index}
title={car.title}
category={car.category}
image={car.image}
money={car.money}
checkCar={this.checkCarModalHandler}
data-category={car.category}
/>
);
});
ReactDOM.render(filteredCars, document.querySelector('.card-cars'));
}, 500);
};
Но на работу эта ошибка не влияет как я вижу
<div className='autopark-categorys'>
<ul>
{this.state.category.map((category, index) => {
return (
<Category
key={index}
category={category}
onChangeCategory={this.changeCategory}
/>
);
})}
</ul>
</div>