UseAppContext hook
The useAppContext hook provides information about AppContext.
The hook signature is described below:
function useAppContext<K extends keyof AppContext>(...sections: K[]): Pick<AppContext, K>;
This hook has the ability to retrieve only specific piece of data by passing names of desired context sections as an array of strings
for optimization purpose. The sections correspond to the AppContext property names: user, language, offlineMode.
Example:
const { user: { isAuthenticated } } = useAppContext(['user']);
if (isAuthenticated) {
//...
}