[Notes] Calculating Derived State in JavaScript Using Selectors

https://nick.scialli.me/calculating-derived-state-in-javascript-using-selectors/

We can use selectors to solve this issue. Selectors are functions that take state as a property and return the derived state value. Let’s see if we can create a selector to replace our allowedIn property.

Our decision is not just based on our state object anymore, but is based on the result of another selector as well. This is where we start using higher order functions to compose selectors from other selectors. 

Many selector libraries (e.g., Reselect for Redux) include additional functionality to memoize selector results.

Great examples that explain why we need Selectors and how to use them for calculating derived State (like a computed property.)

Leave a comment