Skip to content
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

Update 10-Colocating_Selectors_with_Reducers.md #19

Merged
merged 1 commit into from Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions 10-Colocating_Selectors_with_Reducers.md
Expand Up @@ -82,4 +82,12 @@ Now we can go back to our `VisibleTodoList` component and import `getVisibleTodo

`getVisibleTodos` encapsulates all the knowledge about the application state shape, so we can just pass it the whole state of our application and it will figure out how to select the visible todos according to the logic described in our selector.

Finally, we can refer back to our `mapStateToProps` mapping function and call `getVisibleTodos()` with the entire state, rather than with `state.todos` like we used to (this logic has been moved to the reducer):

```
const mapStateToProps = (state, { params }) => ({
todos: getVisibleTodos(state, params.filter || 'all' )
});
```

[Recap at 2:51 in video](https://egghead.io/lessons/javascript-redux-colocating-selectors-with-reducers?series=building-react-applications-with-idiomatic-redux)