createSelector1<S, R1, T> function
Selector<S, T>
createSelector1<S, R1, T>(
- Selector<
S, R1> selector, - T combiner(
- R1
- T Function(R1) memoize(
- T (
- R1
- T (
Create a memoized selector starting with one selector. It will cache the
result of the combiner
function, and only recompute when the provided
selector delivers new results.
A complete example can be seen as part of the Selector documentation.
Implementation
Selector<S, T> createSelector1<S, R1, T>(
Selector<S, R1> selector,
T Function(R1) combiner, {
T Function(R1) Function(T Function(R1))? memoize,
}) {
final memoized = (memoize ?? memo1)(combiner);
return (S state) {
return memoized(selector(state));
};
}