Answer the question
In order to leave comments, you need to log in
How to make a function execute only on click in setState?
hello i have this code
this.setState({
Products: products.map((product, index) => {
return(
<div className="catalog-item" onClick="console.log('click)" key={index} data-id={product._id}>
<div className="catalog-item__top">
<h4>{product.name}</h4>
</div>
</div>
)
})
})
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