Skip to content

translate store/*.md #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xuxusheng
Copy link
Contributor

translated the rest of the store directory


### Using selectors for multiple pieces of state
`createSelector` 可以用来根据同一状态的几个切片从状态中选取一些数据。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pieces 译成 切片 有点不太妥,这里应该是指 featureReducer 里面的 state, 译成 用 选择器来选择state 中的部分内容。


You can use the `createSelector` to achieve just that. Your visible books will always be up to date even if you update them in `allBooks` and they will always show the books that belong to your user if there is one selected, and will show all the books when there is no user selected.
你可以使用 `createSelector` 来实现这一点。只要有被选择的用户,可见的书籍将始终处于最新状态,甚至当你在 `allBooks` 中更新了它们。如果没有用户被选择则显示所有的书籍。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有一些拗口,但是意思达到了。而且我也没想到更顺的语句。

The functions returned by the `createSelector` and `createFeatureSelector` methods become alternatives to the string syntax for retrieving the relevant piece of state.

### Example
## 通过 Store 使用选择器
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a Selector with the Store
或许译为
在 Store 中使用 选择器 (Selector)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants