0
onUpdateItem = i => {
this.setState(state => {
const subtarefa = state.subtarefa.map((item, j) => {
if (j === i) {
item.status = !item.status
return item;
} else {
return item;
}
});
return {
subtarefa
};
});
};
'Cause that part doesn’t work?
item.status = !item.status
Could you present what problem is happening? Apparently, only with what was provided the problem consists of the missing character
;
at the end of the instruction.– Vitor Subhi
is not reversing the value of the variable
– Natã Lopes
@Natãlopes You are sure that the execution is falling on this line of code?
– Jéf Bueno
i put a console.log and do not know pq but the function is running twice in that part so in case it changes and dps return the value
– Natã Lopes
It’s so hard to know just by looking at the code, but there’s the condition that might not be satisfying and the other thing too the variable might not really be being altered by the immutable factor (maybe). Put the whole component in the question !!!
– novic