How to map through an array of objects and add value to each other in React?

I would like to sum one specific value from my array of objects.

my array:

const myArray = [
{package_id: 1, width: "30"},
{package_id: 2, width: "20"},
{package_id: 3, width: "50"}
]

The value I would like to achive is the width. So the result would be 100
Is there any way to do this?

111 thoughts on “How to map through an array of objects and add value to each other in React?”

  1. I have been exploring for a little bit for any high-quality articles or weblog posts on this sort of house .
    Exploring in Yahoo I at last stumbled upon this web site.

    Studying this info So i am glad to express that I’ve an incredibly excellent uncanny feeling I discovered just what I needed.
    I most indisputably will make sure to do not omit this website and give
    it a glance on a relentless basis. https://hydroxychloroquinee.com/

    Reply
  2. Pingback: deltasone cost
  3. Pingback: stromectol is for
  4. Pingback: ivermectina dosis

Leave a Comment