useStateSelectorShallow()
function useStateSelectorShallow<TState, Selected>(
selectStateFieldFunc: SelectStateFieldFunction<TState, Selected>,
fieldName?: string | string[],
opts?: UseStateSelectorOptions<Selected>): Selected;
Generic selector that receives a field selector function returned from getSelectField.
Type Parameters
TState
TState = unknown
Selected
Selected = unknown
Parameters
selectStateFieldFunc
SelectStateFieldFunction<TState, Selected>
the store state's field selector function
// reducer.js
import { getSelectField } from 'elliemae/pui-app-sdk';
const name = 'someState';
export selectStateFieldFunc = getSelectField(name);
fieldName?
string | string[]
the state's field you want to acccess, this accepts nested objects access, like so 'rootObj.childObj.field'
opts?
UseStateSelectorOptions<Selected> = {}
options (defaultValue, equalityFn = shallowEqual)
Returns
Selected
See
/lib/api/helpers.ts#getSelectField
This is the same as useStateSelector with shallowEqual as default for equalityFn option.