Holds a single value.
WARNING: This module cannot hold
undefined
values (see https://redux.js.org/recipes/structuring-reducers/initializing-state#summary). Usenull
,false
or other appropriate value instead.
function value<T>(
patterns: {
set?: Pattern,
reset?: Pattern,
},
initialState: T,
): Reducer<T>
/*
* [set]: set `payload` as value.
*/
type SetAction<T> = {
type: string,
payload: T,
}
/*
* [reset]: set value to `initialState`.
*/
type ResetAction = {
type: string,
}
This module has no selectors since it's just a plain value that can be selected normally.