From the course: React: State Management (2019)

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Redux feature container

Redux feature container - React.js Tutorial

From the course: React: State Management (2019)

Start my 1-month free trial

Redux feature container

- [Instructor] Now that we've implemented out boilerplate, it's time to integrate our existing boilerplate into our container and our component. First let's take a look at MainSection.js in our containers directory. You can see that we have an empty mapStateToProps function. What mapStateToProps does is it maps a redux state to props that get passed down to the component that it's connected to. Here, what we're going to want to do is actually just return the keys that we care about. Here, that's going to be books, which is state.books.books and then completedBooks, which is state.books.completedBooks. Now, if you're wondering why were using state.books.books, remember that in index.js we have a key here called books from combineReducers, and then in addition to that, we have another key called books here, from our books reducer. We only care about this classicBooks array, which is why we're doing state.books.books. So now that we're all set here, it's time to take a look at our…

Contents