I'm trying to set new values to a state, but I can't do this with the methods, the state stills the same.
here a declare my state
this.state = {
notes: [],
selected: null
};
}
using componentDidMount I can update the state
componentDidMount() {
this.setState({
notes: this.service.notes,
selected: {
title: "vazio",
text: "vazio"
}
});
}
but when I use this methods to update, the state stills the same
onSelect(note) {
this.setState({
selected: note
});
}