I'm really new in react and i am trying axios to get some data and then with a post request update them. This is my object
{
"id": "text",
"users": {
"George": {
"age": "6"
}
}}
In my code i am trying to get "George" age like this:
const [subparameters, setSubParameters] = React.useState(null);
const params = [];
for (const [key, value] of Object.entries(r.data.users.George)){
const _parm = {parKey: key, parValue: value };
console.log(_parm);
params.push(_parm);
setSubParameters(params)
}
But in my POST request "George" changes and r.data.parameters.George doesn't work anymore because instead of this name is another one. any ideas of solving this somehow?