📜  显示日期反应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:34.207000             🧑  作者: Mango

代码示例1
import React from "react";

export default class App extends React.Component {
  state = {
    date: ""
  };

  componentDidMount() {
    this.getDate();
  }

  getDate = () => {
    var date = new Date().toDateString();
    this.setState({ date });
  };

  render() {
    const { date } = this.state;

    return 
{date}
; } } } export default App;