September 2018
Intermediate to advanced
302 pages
7h 17m
English
Let's face it, we did not have any abstraction on accessing the store so far. This means that every mapStateToProps function accessed it on its own. In case of store shape change, all mapStateToProps functions could be affected. The first step is to separate the concerns and provide selectors, instead of straightforward object access:
// src/Chapter 8/Example 1/src/features/// ./tasks/containers/TaskListContainer.jsconst mapStateToProps = state => ({ tasks: tasksEntitiesSelector(state), isLoading: tasksIsLoadingSelector(state), hasError: tasksHasErrorSelector(state), errorMsg: tasksErrorMsgSelector(state)});
The implementation is just the same as before, with the simple exception that we can reuse the code in ...
Read now
Unlock full access