The first argument, often a Redux root state object.
All additional arguments passed into the selector.
A derived value from the state.
The array of the input selectors used by createSelector
to compose the
combiner (memoizedResultFunc
).
Counts the number of times the input selectors (dependencies
)
have been recalculated. This is distinct from recomputations
,
which tracks the recalculations of the result function.
The last result calculated by memoizedResultFunc
.
The memoized version of resultFunc
.
Counts the number of times memoizedResultFunc
has been recalculated.
Resets the count dependencyRecomputations
for the input selectors (dependencies
)
of a memoized selector.
Resets the count of recomputations
count to 0.
The final function passed to createSelector
. Otherwise known as the combiner
.
The optional memoize function that is used to memoize the arguments
passed into the output selector generated by createSelector
(e.g., lruMemoize
or weakMapMemoize
).
When passed directly into createSelector
, it overrides the
argsMemoize
function initially passed into createSelectorCreator
.
If none was initially provided, weakMapMemoize
will be used.
import { createSelector, weakMapMemoize } from 'reselect'
const selectItemsByCategory = createSelector(
[
(state: RootState) => state.items,
(state: RootState, category: string) => category
],
(items, category) => items.filter(item => item.category === category),
{ argsMemoize: weakMapMemoize }
)
The memoize function that is used to memoize the resultFunc
inside createSelector
(e.g., lruMemoize
or weakMapMemoize
).
When passed directly into createSelector
, it overrides the memoize
function initially passed into createSelectorCreator
.
A function that takes a state and returns data that is based on that state.