Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • P

    @maria-luiza-rodrigues-ti

    Submitted

    What are you most proud of, and what would you do differently next time?

    I'm proud of the moment I managed to make the quantity of the product in the cart add up to the quantity I placed every time I clicked the add to cart button. It was a detail in the project that I had a lot of difficulty developing.

    What challenges did you encounter, and how did you overcome them?

    I had a lot of difficulty to manage the quantity of products sending to minicart. The way that I found to solve that was:

    export function Minicart({ onAddProductToCart }: MinicartProps) {
    
      const products = onAddProductToCart();
      const [productInTheMinicart, setProductInTheMinicart] =
        useState();
      const [quantityOfProductInTheMinicart, setQuantityOfProductInTheMinicart] =
        useState(0);
    
      useEffect(() => {
        if (!products) return;
        setProductInTheMinicart(products);
      }, [products]);
    
      useEffect(() => {
        if (productInTheMinicart?.quantity !== undefined) {
          setQuantityOfProductInTheMinicart(
            (state) => state + productInTheMinicart?.quantity
          );
        }
      }, [productInTheMinicart?.quantity]);
    
    ...
    

    What specific areas of your project would you like help with?

    I want to know if there's another efficent way to solve the problem that I explained in the first question.

    @javila26

    Posted

    Hi María,

    Great project, I used it as reference when building my solution. I created a state which holds an array of products to buy, this one is filled out when setting the quantity of the product, so once this array has information I passed to the mini-cart component so it can render dynamically its content.

    0
  • nicode 120

    @NikaBabashvili

    Submitted

    This is the Best project i have ever made. feedbacks are welcomed !

    @javila26

    Posted

    Hello, good job by doing this to only display block-inline. Something that could leverage your skills to the next point would be learning display Flex and Grid. There's a bunch of youtube videos explaining these two concepts and they are really helpful.

    1