Ramda - Reselect
Implementation of the reselect library using ramda.
Purpose
- Example of how to recreate your own selector abstraction using ramda.
- A small implementation of createSelector for lazy folks like me 🐱.
How-to
You can create the same createSelector function as used by reselect with Ramda like so, nice and easy, no library needed 😅 :
const createSelector =R
Right now that can't handle props, but tbh I never use props in my stateful components. Perhaps you do, so a full version of createSelector that matches reselect's api and passes their tests is provided as an npm package.
But why not write a 'createSelector' to suit your use case. 💫
Example
const shopItemsSelector = stateshopitemsconst taxPercentSelector = stateshoptaxPercentconst subtotalSelector =const taxSelector =const totalSelector =let exampleState =shop:taxPercent: 8items:name: 'apple' value: 120name: 'orange' value: 095console // 2.15console // 0.172console // { total: 2.322 }