mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 16:37:07 +02:00
* prepare v1-v2 domain switch * rename v1 changelog as CHANGELOG-1.x.md * switch v1/v2 changelogs * Cleanup v2.docusaurus.io urls * add netlify domain redirect * remove circleci config * remove another circle file
23 lines
715 B
TypeScript
23 lines
715 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import {useContext} from 'react';
|
|
|
|
import ThemeContext from '@theme/ThemeContext';
|
|
import type {ThemeContextProps} from '@theme/hooks/useThemeContext';
|
|
|
|
function useThemeContext(): ThemeContextProps {
|
|
const context = useContext<ThemeContextProps | undefined>(ThemeContext);
|
|
if (context == null) {
|
|
throw new Error(
|
|
'`useThemeContext` is used outside of `Layout` Component. See https://docusaurus.io/docs/api/themes/configuration#usethemecontext.',
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
export default useThemeContext;
|