From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Reselect usage and demo

Reselect usage and demo

Welcome back, now the problem that we discussed in the previous video, we can solve it using the reselect library. The reselect library provides a create selector hook and we have to use that create selector hook to actually calculate all the filtered results that we can have on our UI. What it does is that it returns a cache result if your input hasn't changed. So right now we are having 10 users and we are not creating any other user. So what is going to do is that if your data hasn't changed, then it will calculate the filtered results once. It will calculate the filtered result once and then next time if the data hasn't changed and you try to filter that then it's going to return a memoized result which is being cached. So, it does not has to perform the filtration again and again. You can link it with a real-world analogy of thinking it like a calculator's memory that it reuses the last results until the inputs has changed and it's going to return back that result. So, you can…

Contents