D
D
Denis Sokolov2020-11-02 23:47:59
React
Denis Sokolov, 2020-11-02 23:47:59

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;
    };


With this function, it displays [object Object] for me, although it is necessary that it displays cards with content

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question