docusaurus/packages/docusaurus-theme-classic/src/theme/hooks/useThemeContext.ts
Sébastien Lorber 78349480af
chore: rename v2.docusaurus.io urls after domain switch + redirect + cleanups (#4490)
* 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
2021-03-22 20:57:49 +01:00

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;