Reputation: 1457
The term "Selector" sounds quite confusing to me.
In official doc Computing Derived Data. It makes sense to name the mapping procedure "select" cuz you are indeed filtering something. kinda "select a different piece of the redux store".
But theoretically, you can do any kinda computation within the MapThingsToProps
functions, like transforming a flatten data structure to a nested one that your UI component need, or compute some temp data.
Are names such as "Adaptor", "Data Transformer", or even "Mapper" are better than "Selector"?
Or if I misunderstand the meaning of "select" or the "selecting process"?
Thank you!
Upvotes: 0
Views: 194
Reputation: 219
I guess it must be something similar to the SQL SELECT. There is normalized data stored in a RDB or Redux store and you can select a projection of this data with some denormalization or convolution, or even select anything you want such as a constant or current date.
Upvotes: 1
Reputation: 67459
The term "selector" appears to have first been used in redux#47, and the idea was inspired by the "getter" concept from the NuclearJS library.. I don't see a specific mention of why that term was used. However, the first couple iterations of connect()
used the name select
for the data retrieval function instead of mapStateToProps
, so I'm guessing it came from that.
Overall, I think you're overthinking the terminology a bit :)
Upvotes: 1