title: How to render a child component multiple times using a loop?
body: <p>This is my function to remove a product once the user has checked out and purchased the item:</p>
  <pre><code>function RemoveProduct (props)  {
    console.log(props)
    const [editProduct] = useMutation(queries.EDIT_PRODUCT);
         let { loading, error, data} = useQuery(queries.GET_PRODUCTS_BY_ID, {
           fetchPolicy: &quot;network-only&quot;,
           variables: {
             _id : props.id
           },
         });
         if (error) {
          return &lt;h1&gt; error&lt;/h1&gt;;
      } else if (loading) {
          return &lt;h1&gt; loading&lt;/h1&gt;;
      } else if(data){
        
         let a = data.quantity - props.quantity
         console.log(a)
         editProduct({
           variables: {
             _id : props.id,
             quantity: a
           },
        });
         
      }
     }
    
  export default RemoveProduct
  </code></pre>
  <p>This is rendered when the page redirects to the success page:</p>
  <p>AddOrder.js:</p>
  <pre><code>for (let i = 0; i &lt; data.getUser.cart.length; i++) {
              total += data.getUser.cart[i].price * data.getUser.cart[i].quantity;
              newCart.push({
                  orderedQuantity: data.getUser.cart[i].quantity,
                  _id: data.getUser.cart[i]._id,
                  name: data.getUser.cart[i].name,
                  image: data.getUser.cart[i].image,
                  price: data.getUser.cart[i].price,
              });
              &lt;RemoveProduct id={data.getUser.cart[i]._id} quantity={data.getUser.cart[i].quantity}/&gt;
          }
  </code></pre>
  <p>As data is stored in the cart as an array of objects I am trying to call the RemoveProducts method in a loop iterating over the cart items. I placed multiple console.logs in the RemoveProducts component but none of them send any data nor does the quantity decrease when the redirect to success page is done. The above AddOrdre function is called when the page redirects to success. This code has no effect, how can I fix this? I am able to perform all these functions from the playground so the graphql queries seem fine.</p>