InterviewHubPRO
Section Overview
Q128

Question 128 of 445

Part 5: React Redux State Management (101 - 134)

29%
React & Modern Frontend (445 Qs)•Part 5: React Redux State Management (101 - 134)

What are Redux selectors and why use them?

Selectors are functions that take Redux state as an argument and return some data to pass to the component.

For example, to get user details from the state:

javascript
const getUserData = (state) => state.user.data;

These selectors have two main benefits,

  1. The selector can compute derived data, allowing Redux to store the minimal possible state
  2. The selector is not recomputed unless one of its arguments changes