- We now have a component that only understands the items in the cart.
- If we had several hundred, or thousands of items, rerendering all the items in our cart would be costly even if only the tax-percentage changes.
- Changing the tax percentage would trigger a recalculation of the items in the cart, but shouldn’t.
- We define selectors as the functions that retrieve snippets of the Redux state for our React components.
- The first function (Line 3) will simply get all the items in the cart and the second function represents a memoized selector.
Read the full article, click here.
When used together, React and Redux are an awesome combination of technologies that help us structure applications with a true separation of concerns. Even with React being extremely performant out of the box, there comes a time when even higher performance is required.
Improving React and Redux performance with Reselect