I have this array of data which I want to manipulate and return another array of object with only what I need, so I was thinking when I receive the api data it is possible to create an map responses like:
const [stateData, setStateData] = useState({stateData:[]});
Promise.all(promises).then(response => {
let info = [];
response.forEach(res => {
info = info.concat(res.info);
});
//and here to add my map:
const myData = info.map(fiterData,index) => {
return info [
{"id":fiterData.id},
{"name":fiterData.name},
{"name":fiterData.description}
// and so on ...
]
}
setStateData(info);
});
and afterwards to access like myData.property ?
So will work if will be used in this way ?