O3 Framework / useAppContext
useAppContext<
T>(namespace):undefined|Readonly<T>
Defined in: packages/framework/esm-react-utils/src/useAppContext.ts:26
This hook is used to access a namespace within the overall AppContext, so that a component can use any shared contextual values. A selector may be provided to further restrict the properties returned from the namespace.
T extends object = object
The type of the value stored in the namespace
string
The namespace to load properties from
undefined | Readonly<T>
// load a full namespace
const patientContext = useAppContext<PatientContext>('patient');
// loads part of a namespace
const patientName = useAppContext<PatientContext, string | undefined>('patient', (state) => state.display);