how to add and get value from this child array using react

Viewed 34

enter image description here

[1:{
id: "3245fe9f-968b-4eb8-a575-3bcc41139766"
key: "9597a0d5-24f5-4dad-bfbc-807cda59617b"
measurement: "Length"
unit: [
0: {
unitName: 'Milimeter',
shortName: 'mm'
},
1: {
unitName: 'Meter',
shortName: 'm'
}
]}]

[enter image description here][2]

[enter image description here][2]

I want to get values for this component. [2]: https://i.stack.imgur.com/jPUWB.png

1 Answers

It would be helpful that if you give some description for it.

It seems like you are trying to access the inside data. For that you can use loops. Here is example

arr.forEach(ele => {
     ele.unit.forEach(unitObj => {
         //here you can access the unitObj data. Either get or add
     })
})
Related