react(入門)

react(入門) 生命週期 getDefaultProps() 設置默認的props,也可以用dufaultProps設置組件的默認屬性. getInitialState() 在使用es6的class語法時是沒有這個鉤子函數的,可以直接在constructor中定義this.state。此時可以訪問this.props componentWillMount() 組件初始化時只調用,以後組件更新不
相關文章
相關標籤/搜索