production-evyos-systems-an.../docs/frontDocs/contexts/component_contexts.md

25 lines
572 B
Markdown

# Context
Syncs each step of user's session with redis backend.
```typescript
// Create the config hook using the factory
const useContextConfig = createContextHook<ClientPageConfig>({
endpoint: "/context/page/config",
contextName: "config",
enablePeriodicRefresh: false,
});
// Wrapper hook that adapts the generic hook to the expected interface
export function useConfig(): UseConfigResult {
const { data, isLoading, error, refresh, update } = useContextConfig();
return {
configData: data,
isLoading,
error,
refresh,
update,
};
}
```