DEV Community

Discussion on: Is anyone still actively using reselect createSelector?

Collapse
 
vldmrgnn profile image
Vlad • Edited

Hello, I am using reselect heavily and I am ok with it.
The stack from this pov is React Redux + Redux Saga + Reselect;

Now and then I am passing variables like this:

import { createSelector } from 'reselect';
...
const getStuff = state => state.stuffReducer; 
const sParams  = (state, someIds = [] ) => someIds; // <- as variables;

export const someSelector = createSelector(
    sParams,
    getStuff,    
    (someIds, stuff) =>{
        ...
    }
);
Enter fullscreen mode Exit fullscreen mode

(perhaps it could be optimized when using params, memoize those too with no extra boiler-plate)

Then import the selector in saga using "select" or in component using "useSelector" and that's it.

When needed I make use of "reselect-map" ( github.com/HeyImAlex/reselect-map ) which is awesome in some scenarios.

I find it very comfortable combining selectors in reselect.

Good luck and keep us informed on this!