Demo: Selector Composition

Let's implement the selector composition technique in our application.

Introduction

In this lesson, we’ll learn how the createSelector() function works by implementing it in the ProductModule of our application.

Since we already have all the product info in the products slice, we don’t need to make an additional API request to get a particular product’s information. Instead, we can save the product id in the product slice and then use the selector composition approach to retrieve the product information from the products slice of the NgRx store. As a result, our application speed will improve. To achieve this, we modify the following files one by one:

Get hands-on with 1200+ tech skills courses.