Open OkomoJacob opened 2 years ago
addItem(event) {
const text = prompt('TODO text please!');
// only do this if text has value else return alert
text && this.setState({
todos: [...this.state.todos, { id: id++, text: text, checked: false }],
});
}
setToDoList
and we can only do that when theaddToDoTask()
function has access to that state in theApp.js
.alert
useState
andsetState
hooks.