@dynamic-selectors/with-reselect
v1.2.1
Published
Use dynamic selector functions with Reselect
Downloads
6
Maintainers
Readme
@dynamic-selectors/with-reselect
Helper functions to make it easy to use Dynamic Selectors and Reselect together.
For more information or related packages, see the Dynamic Selectors workspace.
What's included
import {
reselectSelectorFromDynamic,
dynamicSelectorFromReselect,
wrapReselect,
} from '@dynamic-selectors/with-reselect';
reselectSelectorFromDynamic(dynamicSelector, params?)
Create a Reselect selector from any dynamic selector. You can specify the params to use with the dynamic selector, if it accepts params.
const originalSelector = createDynamicSelector(/* dynamic-selector for use with reselect */);
const newSelector = reselectSelectorFromDynamic(originalSelector);
dynamicSelectorFromReselect(reselectSelector)
Creates a normal dynamic selector from any Reselect selector (using createDynamicSelector
, by default).
If you're using a custom dynamic selector factory, you should use wrapReselect
instead.
const originalSelector = createSelector(/* reselect selector for use with dynamic-selectors */);
const newSelector = dynamicSelectorFromReselect(originalSelector);
wrapReselect(reselectSelector)
Converts any Reselect selector into a function that you can pass to your own customized dynamic selector factory.
The default dynamicSelectorFromReselect
helper is just shorthand for createDynamicSelector(wrapSelector(selectorFn))
const myCustomSelectorFactory = dynamicSelectorForState(/* custom options */);
const originalSelector = createSelector(/* custom dynamic-selector for use with reselect */);
const newSelector = myCustomSelectorFactory(wrapSelector(originalSelector));