useConfig

The useConfig hook is made to dynamically configure your project. See Theme Configuration for more information about each customizable feature.

useConfig hook

⚠️

The useConfig hook is made to dynamically configure your project. See Theme Configuration (opens in a new tab) for more information about each customizable feature.

The useConfig (opens in a new tab) hook returns data from your theme configuration and current page context.

Return Values

Signature

The function is in file /packages/nextra-theme-docs/src/contexts/config.tsx (opens in a new tab) and this is the code:

export function useConfig<FrontMatterType = FrontMatter>() {
  return useContext<Config<FrontMatterType>>(ConfigContext)
}

Example

The following code:

 
import { useConfig } from 'nextra-theme-docs'
 
export const logo = () => {
    return useConfig().logo
}
 
- {logo()}

produces:

💡