0
I am studying React and have made a cash flow application using firebase as database. I would like to perform a query using the "map()" or another way that traversed the object showing only the entries of the month of sea, but I am finding it difficult to accomplish this task, since I am using the query Object.Keys. Below is an example of how the object looks after being extracted.
const keysIn = Object.keys(this.props.inflow);
let entrada = JSON.stringify(keysIn);
console.log(entrada)
// O retorno do console.log fica assim
{
'1': {
month: 'fev',
name: 'xxxxxxx',
value: 300,
},
'2': {
month: 'mar',
name: 'yyyyyyyy',
value: 500,
},
'3': {
month: 'mar',
name: 'zzzz',
value: 400,
},
}
But you sure want to use the
map
and not thefilter
?– Sorack
It is not necessary not, I thought of them because I need to go through the object and show all that contain the month "sea".
– Mário Rodeghiero
Plus it’s kind of weird
console.log
return an object to the variableentrada
since theObjects.keys
returns aarray
. You’re sure of it?– Sorack
In case the input variable receives JSON.stringfy(keysIn), then it becomes an object, I even made one typeof to dispel the doubt .
– Mário Rodeghiero