fac24 / week6-bereket-hussain-joe-sonia

https://week6-bereket-hussain-joe-sonia.vercel.app/
0 stars 0 forks source link

Possibilities for quantity-tailoring #33

Open lascellesabercrombie opened 2 years ago

lascellesabercrombie commented 2 years ago

https://github.com/fac24/week6-bereket-hussain-joe-sonia/blob/dd48edae591844451ef295da7a8b37137a687c07/pages/products/%5Bname%5D.js#L40

As with my previous issue, not really an issue. But I quite liked this bit in some code George and Minju wrote:

            <input
              type="number"
              id="quantity"
              name="quantity"
              min="1"
              max={productData.stock}
              value={quantity}
              onChange={(event) => setQuantity(event.target.value)}
            />

Here, the maximum in't an arbitrary number but is tied to a column in the database, so a customer can never attempt to order more of a thing than you have in stock. Then again, I'm not sure whether traders in emotions need to consider scarcity.

joe-dev-public commented 2 years ago

Yeah, that constraining by stock is a great (and realistic :) idea!

It's true, we hadn't really considered stock levels yet -- the assumption was they're infinite ;)