You’ve been building your React apps with a Redux store for quite a while, yet you feel awkward when your components update so often. You’ve crafted your state thoroughly, and your architecture is such that each component gets just what it needs from it, no more no less. Yet, they update behind your back. Always mapping, always calculating.
Reselector to the rescue
How could would it be if you could just calculate what you need? If this part of the state tree changes, then yes, please, update this.
Let’s take a look at the code for a simple TODOs list with a visibility filter, specially the part in charge of getting the visible TODOs in our container component:
... read the whole story at www.jstips.co.