Answer the question
In order to leave comments, you need to log in
How it is possible to make more beautiful formatting?
hello i have this code
<div className="catalog-mobile__counter" key={cart.find(item => item.product._id === product._id) ? cart.find(item => item.product._id === product._id).quantity : "" }>
<div className="catalog-mobile__minus"></div>
<input type="text" defaultValue={cart.find(item => item.product._id === product._id) ? cart.find(item => item.product._id === product._id).quantity : "" } />
<div className="catalog-mobile__plus"></div>
</div>
Answer the question
In order to leave comments, you need to log in
The code looks like it should have been like this:
<>
{cart.map(item => (
<div className="catalog-mobile__counter" key={item.product._id}>
<button className="catalog-mobile__minus"></button>
<input type="text" defaultValue={item.quantity || ''} />
<button className="catalog-mobile__plus"></button>
</div>
))}
</>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question