📜  reactjs 的生命周期 - Javascript 代码示例

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

代码示例1
class Clock extends React.Component {
  constructor(props) {
    super(props);
    this.state = {date: new Date()};
  }

  componentDidMount() {  }
  componentWillUnmount() {  }
  render() {
    return (
      

Hello, world!

It is {this.state.date.toLocaleTimeString()}.

); } }