From the course: Building Modern Projects with React
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Why do we need selectors? - React.js Tutorial
From the course: Building Modern Projects with React
Why do we need selectors?
- [Instructor] All right. So the next React tool that we're going to take a look at here is something called selectors. Now, we've already used selectors before in our React applications, but when we've used them with the used selector hook, we've just sort of hard-coded them. So the idea of selectors is when we actually give these things a name and treat them as something separate from the components that use them. So, here's the idea of why we need selectors in the first place and what they do for us. The first thing that it's important to realize is that the overall structure of our Redux Store can and will change as our React applications get larger and more complex or as the needs of our application change. So just as an example here, right now we're storing our todos under state.todos.value, state being the Redux Store. But we might move that at some point to state.resources.todos.value, just as an example. Or we might decide that the structure of our Redux Store should…