From the course: Building Modern Projects with React

Unlock the full course today

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

More about selectors

More about selectors

From the course: Building Modern Projects with React

Start my 1-month free trial

More about selectors

So, now that we've created our getIncompleteTodos selector, let's create another selector that will give us all of our completed to-do's. And this is going to be very similar to our incomplete selector. We're going to say export const and we'll say getCompletedTodos = createSelector with the arguments getTodos. And the final function here, is simply going to take the to-do's from the state and say todos.filter. And then, it's going to get all of our completed to-do's by saying todo.isCompleted. And that's really all we need to do. But before we move on and incorporate these selectors into our components, there are two things I'd like to note about these kind of selectors. The first thing you should notice, is that just like our components, these higher-order selectors that we've defined are incomplete and completed to-do's, have no idea how our data is formatted in the redux store. Nowhere here are we referring to…

Contents