I have an array like
Const array=[
{
id:1,
name:"abc",
Address:[
{
City: "something",
Country: "first country"
},
{
City: "other city",
Country: "country"
}
]
},
{
...........
}
];
I have to display this nested array objects as flat key value list. So How to reduce this like below.
Reducedarray = [
{ Id: 1, name: "abc" },
{ City: "something", country: "first country"},
{ City: "other city", country: "country"},
{ Id: 2, name: "bbc" },
{ City: "bbcsomething", country: "fbbct country"},
{ City: "other city", country: "country"}
]
Using reducearray i will map with object keys and display as key value list in html.
Need to display as flat list using jsx like below
Id: 1 Name: abc City: first ity Country: firstcountry City: second city Country: second country Id:2 Name: another name ..... ...... ....
Can anyone help me on this plz.. is it possible with reduce only?