class Todo extends React.Component {
constructor() {
super();
this.state = {
task: "",
isCompleted: false,
dateCreated: "",
};
}
// Updating state after Component is mounted
componentDidMount() {
const currentDate = new Date();
const dateString = currentDate.toDateString();
this.setState({dateCreated: dateString});
}
}