Noticed anything weird? We’re doing the filtering inside the useSelector callback. If we did this more than once, our application would slow down drastically. Not to mention it’s not a pretty piece of code to look at. If you’re familiar with Redux, you know that we have reducers to change and store state, actions to fire off state change triggers. The third missing puzzle here is the selector. Selectors fit nicely into the picture here, since we need an efficient way of getting data from our store and rendering it.

Note: we’re using React hooks here combined with Redux. If the useSelector hook is new to you, not to worry! Here’s an article about it.