You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classClockextendsReact.Component{constructor(props){super(props);this.state={date: newDate()}}componentDidMount(){this.Timer=setInterval(()=>this._tick(),1000);}componentWillUnMount(){clearInterval(this.Timer);}_tick(){this.setState({date: newDate()})}render(){return(<div> this is {this.state.date.toLocaleTimeString()}</div>)}}ReactDOM.render(<Clock/>,document.getElementById('root'));
知识点
ES6 的 class 是小写 小写 小写!!!
React.Componet 和 React.createClass
生命周期(生命钩子)
无状态组件和高阶组件
render 执行
。。。
The text was updated successfully, but these errors were encountered:
#componet
知识点
The text was updated successfully, but these errors were encountered: