Sphereとともに

scalaとかplayframeworkとか。技術ブログにしたいなと。環境は Windows7x64, mac です。たまに声優さん情報が混ざります。最近ちょっとClojure触りました。

React Redux createStore 適当訳

createStore(reducer, [initialState], [enhancer])

createStore | Redux

reducer (Function): A reducing function that returns the next state tree, given the current state tree and an action to handle.

reducer とは state を返す 関数で 現在のstate と 操作するための action を引数とするものである。

[initialState] (any): The initial state. You may optionally specify it to hydrate the state from the server in universal apps, or to restore a previously serialized user session. If you produced reducer with combineReducers, this must be a plain object with the same shape as the keys passed to it. Otherwise, you are free to pass anything that your reducer can understand.

stateの初期状態。

[enhancer] (Function): The store enhancer. You may optionally specify it to enhance the store with third-party capabilities such as middleware, time travel, persistence, etc. The only store enhancer that ships with Redux is applyMiddleware().

store 増強剤(?)

Store

Store | Redux

アプリケーション全体の store tree を保持する。
stateを変更する唯一の方法はactionをディスパッチすることである。
storeはクラスではなく、いくつかのメソッドを持った関数である。
storeを作成するためには createStore に root reducing function を渡す。

入門 React ―コンポーネントベースのWebフロントエンド開発

入門 React ―コンポーネントベースのWebフロントエンド開発