Mid From PDF React React.js

What are selectors in Redux?

Selectors are functions that read and return data from the store, often with memoization.

✅ Purpose:

  • Centralize access to state shape
  • Avoid duplication
  • Optimize performance

✅ Basic selector:

const selectUser = (state) => state.user;

✅ With reselect:

import { createSelector } from 'reselect';

const selectCartItems = (state) => state.cart.items;

const selectTotalPrice = createSelector(

[selectCartItems],

(items) => items.reduce((sum, item) => sum + item.price, 0)

);

React Routing

More from React.js Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details