product.js
Qty: <select value={qty} onChange={(e) => { setQty(e.target.value) }}>
{[...Array(product.countInStock).keys()].map((x) => (
<option key={x + 1} value={x + 1}> ===> here i want to show option according to product.countInStock
{x + 1}
</option>
))}
</select>
I want to display options dynamically I get product.countInStock a number like 2,3 I want if the number is 3 then option must be 1,2,3 if the number is 2 like option must be 1,2. How can I display option dynamically