Redux

【Redux】mapDispatchToProps

鬼門connect攻略② mapDispatchToProps Actionをstoreへdispatchする関数 connect( mapStateToProps mapDispatchToProps mergeProps ) 「storeへdispatch」を propsのように各componentを渡らせる性質を持たせる(ToProps) ことに対応させている 具体的な使い…

【Redux】mapStateToProps

鬼門connect攻略① mapStateToProps connectの引数がわからん、ということで調べました 鬼門だらけのconnectさん↓ connect( mapStateToProps mapDispatchToProps mergeProps )(myComponent) まずはmapStateToProps mapStateToProps is 何 「State」を「ToProp…

【Redux】store

store is 何 redux.js.org A store holds the whole state tree of your application. state全般を保存する場所 ・reducerにより生成された新たなstate ・変更が加わっていないstate storeを作る createStoreメソッド : storeを作る storeに全てのreducerを…

【Redux】reducer

reducer is 何 Reduxでの立ち位置 // Redux [View] ↓ [Action] ↓ [Store] [Reducer] ←これ ↓ [View] 新しいState生成マシン Reducer https://redux.js.org/basics/reducers (previousState, action) => nextState // previousStateとactionをもとにnextState…

【Redux】Actionの一般形

Actionの一般形 Flux Standard Actionに書いてあるらしい(ReduxはFluxがもとになっている) qiita.com { type: FOO_TYPE, // must payload: {object}, // optional meta: {object}, // optional error: false, true, undefined, null, ... // optional } 各ke…

【React】ActionとActionCreator

ActionとActionCreatorは区別する redux.js.org // ActionCreator function addTodo(text) { // Action return { type: ADD_TODO, text } }

【Redux】Redux実装

Reduxの思想 component間のprops受け渡し(propsバケツリレー)の煩雑さ解消のため storeを中心としたprops受け渡しとしたもの。 vuexの思想もこれ。 qiita.com Redux実装の流れ ① Action 変更するstateを設定 Action : type、typeに対応する値 ActionCreator …