I'm pretty new to this, how do I add all of my array in the children property? You can kind of guess what I'm trying to do here, but this only gets the last array, not adding every time it loops.
for (let i = 0; i < res.data().productioncompaniesowned.length; i++) {
setData({
id: "root",
name: "Production Company Owned",
children: [{ id: i, name: res.data().productioncompaniesowned[i] }]
});
console.log(i);
console.log(userData.Productioncompany[i]);
}
setData({ children: res.data().owned.map((e, i) => ({id: i, name: e })) })