1import React from "react";
2
3export default class App extends React.Component {
4 state = {
5 date: ""
6 };
7
8 componentDidMount() {
9 this.getDate();
10 }
11
12 getDate = () => {
13 var date = new Date().toDateString();
14 this.setState({ date });
15 };
16
17 render() {
18 const { date } = this.state;
19
20 return <div>{date}</div>;
21 }
22}
23}
24
25export default App;