Skip to content

Commit 4df41db

Browse files
author
wangdong
committed
微调gracefully的翻译,让它更符合语境一些
1 parent 325682b commit 4df41db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

04_get-state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ console.log('store_3 state after initialization:', store_3.getState())
9191
// 3) 注意 { message: action.value } 是怎么被合并到当前 state 来形成新 state 的,
9292
// 这全要感谢牛逼的 ES7 notation (Object Spread): { ...state, message: action.value }
9393
// 4) 还要注意:之所以这个例子能用ES7 Object Spread notation ,是因为它只对 state 里的
94-
// { message: action.value} 做了浅拷贝(也就是说, state 第一个层级的属性直接被 { message: action.value } 粗暴覆盖了 —— 与之相对,其实也可以做个优雅的合并
94+
// { message: action.value} 做了浅拷贝(也就是说, state 第一个层级的属性直接被 { message: action.value } 覆盖掉了 —— 与之相对,其实也有优雅的合并方式
9595
// 但是如果数据结构更复杂或者是嵌套的,那处理state更新的时候,很可能还需要考虑一些完全不同的做法:
9696
// - 可以考虑: Immutable.js (https://facebook.github.io/immutable-js/)
9797
// - 可以考虑: Object.assign (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)

0 commit comments

Comments
 (0)