https://qiita.com/tomzoh/items/7fabe7cb57dd96425867
https://qiita.com/takayuki-ochiai/items/d2fd896627ecf0b466be
https://qiita.com/jabba/items/5ebea8d19809a4e0f8c6
https://super-yusuke.gitbook.io/udemy-course/meteno-react-app/react-dearwosuru
https://github.com/reduxjs/redux/
https://github.com/react-samples/react-redux-tutorial
https://github.com/teradonburi/muiReduxForm
スプレッド演算子、filter,map
const middlware = function ({getState, dispatch}) {
return function(next) {
return function(action) {
next(action)
}
}
}
これが
const myMiddlware = ({ getState, dispatch }) => next => action => {
next(action)
};
| Store | 状態の親玉。でっかいJSONイメージ。subscribeメソッドを実装すると変更検知ができる。dispatchもstoreから行う |
| Action | 名前であるTYPEと中身データのpayloadを持つ。Storeを変えたければActionをコールするところから始まる。 以下のオブジェクトがAction { type : "HOGE_ACTION"} |
| ActionCreator | Actionオブジェクトを返す関数 |
| Reducer | 以前の状態とActionを組み合わせて、新しいStateを作り出す |
| Router | パスとコンポーネントを結びつける |
Router(パスへの追加)→connectでつないだコンポーネント→
reduxのstateをreactのpropsに変換するのと、Actionもpropsにマッピングする。
| mapStateToProps | stateを引数にとってオブジェクトを返す |
| mapDespatchToProps | dispatchを引数にとって、dispatchする複数の関数を返す |
const { testFunction,todos } = props
testFuctionでアクションを呼べる。上の宣言なしだとthis.props.testFunction
todosでpropsを呼べる。this.props.todos
react developer tools(ReactのページでElementタブの右端に出てくる)
http://numb86-tech.hatenablog.com/entry/2016/11/20/124316 https://blog.mismithportfolio.com/web/20161107reactrouter