use-optimized-selector
Ƭ Comparer<Return>: (prev
: Return, next
: Return) => boolean
A memoized or constant function in the form of:
(prevValue, nextValue) => boolean
Return true when objects are considered equivalent.
Name |
---|
Return |
▸ (prev
: Return, next
: Return): boolean
Name | Type |
---|---|
prev |
Return |
next |
Return |
Returns: boolean
Defined in: use-optimized-selector.ts:22
Ƭ Selector<Value, Return>: (value
: Value) => Return
A memoized or constant function in the form of:
(sourceValue) => derivedValue
Name |
---|
Value |
Return |
▸ (value
: Value): Return
Name | Type |
---|---|
value |
Value |
Returns: Return
Defined in: use-optimized-selector.ts:13
▸ Const
useOptimizedSelector<Value, Return>(selector
: Selector<Value, Return>, comparer?
: Comparer<Return>): Selector<Value, Return>
A hook that caches the value of a selector given an optional comparer.
It will return the previous value when present and comparer returns true, bailing out of setState and consequent renders.
Useful for optimizing selectors for useContextSelector, useSubscriptions, useMutableSource, etc.
Name |
---|
Value |
Return |
Name | Type | Description |
---|---|---|
selector |
Selector<Value, Return> | A memoized or constant selector |
comparer |
Comparer<Return> | A memoized or constant comparer |
Returns: Selector<Value, Return>
Defined in: use-optimized-selector.ts:60