Good afternoon, I hope my question is not confusing and if it is with the description it will be understood, first of all let's look at this array.
const recursos = [
{
data: {nombre: "juan", apellido: "cepeda"},
component: Component
},
{
data: {nombre: "ricardo", apellido: "mejia"},
component: Component
}
]
With this structure I need to work and then what happens from the database I need to fill my array with that data, from the database I receive the data like this.
const datosDb = [
{
nombre: "juan",
apellido: "cepeda"
},
{
nombre: "ricardo",
apellido: "mejia"
}
]
Now, I need that within each data within resources it is filled with an object, it can be in the same order within the array. I can think I would need the empty backbone, like this.
const recursos = [
{
data: {},
component: Component
}
]
and try I don't know something like that.
let numberMaxObject: number = recursos.length;
let i: number = 0;
while (i < numberMaxObject) {
recursos.find(object => funcion(){
object.data = array[i]
})
i++;
}
I sincerely know that this would not work like this but it was the only thing that occurred to me and I tried or thought that maybe I have to do it in a similar way or maybe there is another way and I'm getting very complicated but well I'll leave that which was the only thing what to try