First Commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { use } from 'react';
|
||||
|
||||
// @project
|
||||
import { ConfigContext } from '@/contexts/ConfigContext';
|
||||
|
||||
/*************************** HOOKS - CONFIG ***************************/
|
||||
|
||||
/**
|
||||
* Custom hook to access the application's configuration context.
|
||||
*
|
||||
* This hook provides an easy way to consume the `ConfigContext`,
|
||||
* which typically contains application-wide settings like themes,
|
||||
* layouts, or other configurable options.
|
||||
*
|
||||
* @returns {any} The value provided by the `ConfigContext`.
|
||||
* Ensure that the component using this hook is wrapped with a `ConfigProvider`.
|
||||
*/
|
||||
|
||||
export default function useConfig() {
|
||||
const context = use(ConfigContext);
|
||||
|
||||
if (!context) throw new Error('useSConfig must be use inside ConfigProvider');
|
||||
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user