Basically i have two arrays which i am using it for the configuration of buttons.
First array which defines how many buttons should be present and in order.
buttonGroups: [ 0, 2 ]
Another array of objects which says about the actual buttons.
buttons = [
{
buttonLabel: 'label1',
cond1: true,
cond2: false
},
{
buttonLabel: 'label2',
cond1: true,
cond2: false
},
{
buttonLabel: 'label3',
cond1: false,
cond2: true
}
];
The buttonGroups is the configuration array. If it has only [0, 1] then first two buttons will exist. If buttonGroups has only [0, 3] we should have first and third button exists in buttons array.
This is what i have tried
buttonGroups.map((payload1, index1) => {
buttons .map((payload2, index2) => {
if(index1 === index2){
//Display Here only the matched index from ButtonGroups
console.log(payload2)
}
})
})
This is giving the first index button array. How to get the matched array buttons?