Problem Statement
How do you compose selectors and why is this pattern useful?
Explanation
You compose selectors by creating simple input selectors that extract raw state values, then combining them using createSelector from reselect which takes input selectors as arguments and a result function that transforms their outputs into derived data. Selector composition allows you to build complex selectors from simple reusable pieces, automatically memoizes results so expensive computations only run when inputs change, and maintains separation of concerns by keeping domain logic in selectors rather than components. You can create selector hierarchies where high-level selectors depend on lower-level ones, making your code more maintainable and testable.
