關(guān)鍵字:
==>wp rest api
==>redux(三大塊:action、reducer召夹、store)
==>各部分組件機構(gòu)
==>this.props.children(用于實現(xiàn)動態(tài)組件)
==>axios
==>es6字符串的新寫法(` ?`反引號)
==>connect的用法(import { connect } form 'react-redux')
==>middlewares的用法(異步發(fā)送action)
==>moment的用法(import moment form 'moment' )
==>容器組件和可視化組件
==>this.props用于父組件傳遞數(shù)據(jù)給子組件绽淘,父組件申明一個自定義屬性并設(shè)值<Child name="roy">币厕,子組件接受這個自定義屬性的值{this.props.name},getDefaultProps方法居兆,設(shè)置默認的props值瘦黑。
==>this.setState用于input等互動型的組件剧防,getInitialState方法植锉。變更的父組件state后通過props傳遞給子組件。
==>wp rest api:
1.安裝phpStudy和wordpress
2.phpStudy站點域名設(shè)置和hosts內(nèi)容添加
3.wordpress安裝wp rest api插件
給瀏覽器安裝json-handler插件峭拘,這樣獲取的json格式能在瀏覽器當中自動換行顯示
==>redux:
三大塊:action俊庇、reducer、store鸡挠,它們都是相應(yīng)的函數(shù)處理模塊辉饱,三者的順序為先action,然后reducer拣展,最后store彭沼。
action:返回一個對象給reducer,觸發(fā)動作
reducer:處理接受action傳遞過來的東西
store:接收reducer傳遞過來的東西备埃,其相當于一個倉庫姓惑,把網(wǎng)站的所有數(shù)據(jù)都儲存在里面
==>各部分組件機構(gòu):
組件模板:
importReact, { Component }from'react';
export default classFooterextendsComponent {
constructor(props) {
super(props);
}
render() {
return(
Designed By @Blwoosky
Copyright ? 2013-2015 BlwooSky.COM
);
}
}
==>moment的用法(import moment form 'moment' ):