state = {
done: false
};
onLabelClick = () => {
this.setState({
done: true
});
}
let classNames = "todo-list-item";
if (done) {
classNames += " done"
}
.todo-list-item done {
text-decoration: line-through;
}
.todo-list-item.done {
text-decoration: line-through;
}
state = {
done: false,
};
onLabelClick = () => {
this.setState({
done: true
});
};
render() {
return (
<div className={'todo-list-item' + (this.state.done ? ' done' : '')} onClick={this.onLabelClick}>text</div>
);
}