소스 검색

update count example comments

Evan You 9 년 전
부모
커밋
c878499317
1개의 변경된 파일5개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 7
      examples/counter/store.js

+ 5 - 7
examples/counter/store.js

@@ -25,19 +25,17 @@ const actions = {
   increment: INCREMENT,
   decrement: DECREMENT,
 
-  // for conditional actions that depend on the state,
-  // we can provide a thunk (a function that returns a function)
-  // the returned function will get two arguments,
-  // the first being the dispatch function and the second is
-  // the state tree.
+  // for a normal action function, it always recieves the store
+  // instance as the first argument, from which we can get the
+  // dispatch function and the state object. Any additional
+  // arguments will follow the store argument.
   incrementIfOdd: ({ dispatch, state }) => {
     if ((state.count + 1) % 2 === 0) {
       dispatch(INCREMENT)
     }
   },
 
-  // we also use thunks for async actions.
-  // you can dispatch multiple mutations inside a thunk action.
+  // Same thing for async actions.
   incrementAsync: ({ dispatch }) => {
     setTimeout(() => {
       dispatch(INCREMENT)