Reference for @docusaurus/core: Link, Head, BrowserOnly, ErrorBoundary components and hooks including useDocusaurusContext, useBaseUrl, useGlobalData, and usePluginData.
Use this file to discover all available pages before exploring further.
The @docusaurus/core package exposes a public client-side API for use inside React components and pages. It includes prebuilt components for navigation and document head management, React hooks to access site context and plugin data, and utility modules for environment detection.All items on this page can be imported directly from their respective Docusaurus packages without installing anything extra — they are provided by the Docusaurus runtime.
A wrapper around React Router’s <Link> component with Docusaurus-specific enhancements. It prefetches linked pages as they scroll into view and triggers a high-priority prefetch on hover. External links automatically receive target="_blank" rel="noopener noreferrer". The baseUrl prefix is applied to all internal paths automatically.
Prefer <Link> over the native <a> tag for all internal navigation. Docusaurus performs broken-link detection, prefetching, and base URL injection only through this component.
import React from 'react';import Link from '@docusaurus/Link';export default function Nav() { return ( <nav> <Link to="/docs/intro">Documentation</Link> <Link to="https://github.com/facebook/docusaurus">GitHub</Link> </nav> );}
Manages changes to the HTML <head> from inside React components. Built on top of React Helmet. Accepts standard HTML head tags as children. Duplicate tags from child components override those from parent components.
Import:import {Redirect} from '@docusaurus/router'
Renders an immediate client-side redirect to a new location. Replaces the current entry in the browser history stack, matching the behavior of an HTTP 3xx redirect.
@docusaurus/router re-exports React Router and supports all of its features.
import React from 'react';import {Redirect} from '@docusaurus/router';export default function OldPage() { return <Redirect to="/docs/new-location" />;}
Import:import BrowserOnly from '@docusaurus/BrowserOnly'
Renders its children only after the React app has hydrated in the browser, preventing server-side rendering of code that requires browser globals such as window or document.
Import:import ErrorBoundary from '@docusaurus/ErrorBoundary'
A React error boundary that catches rendering errors thrown by its child component tree and displays a fallback UI instead of crashing the entire page.
<ErrorBoundary> only catches client-side render errors. It does not catch errors that occur during the static build (docusaurus build).
Optional render callback. Receives the caught Error object and a tryAgain function to reset the boundary. If omitted, the @theme/Error component is rendered instead.
The fallback prop is a render callback, not a React functional component. You cannot call React hooks inside it.
Import:import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
Returns the Docusaurus context object, which includes the full siteConfig from docusaurus.config.js, site version metadata, i18n state, and global plugin data.
Do not use useBaseUrl for regular navigation links. Docusaurus automatically prepends baseUrl to all absolute paths in <Link to="..."> and in Markdown links. Only use this hook for raw attribute values that bypass that processing (e.g., <img src>).
Import:import useGlobalData from '@docusaurus/useGlobalData'
Returns the full global data object populated by all plugins. Data is namespaced by plugin name and then by plugin instance ID ("default" when a plugin is used only once).
function useGlobalData(): Record< string, // plugin name Record< string, // plugin instance ID ("default" by default) unknown // plugin-specific data shape >>;
Inspect your site’s global data by looking at .docusaurus/globalData.json after running docusaurus start or docusaurus build.
Import:import useIsBrowser from '@docusaurus/useIsBrowser'
Returns true after the React app has hydrated in the browser, false during server-side rendering.
Use this hook instead of typeof window !== 'undefined' in render logic. React requires the first client-side render to match the server-side render exactly. Using typeof window directly can cause hydration mismatches.
Import:import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'
An object exposing boolean flags that describe the current JavaScript execution environment. Use this for non-rendering logic (e.g., conditional require() calls). For React rendering, prefer <BrowserOnly> or useIsBrowser().