React Hooks
    Preparing search index...

    Function useDocumentTitle

    • Updates the document.title for the current page.

      This hook automatically updates the document title when mounted, and optionally restores the original title when unmounted.

      Parameters

      • title: string

        The new title to set

      • __namedParameters: DocumentTitleOptions = {}

        Optional configuration

      Returns void

      This hook uses React hooks internally:

      • useCallback - to memoize formatting and setting functions.
      • useEffect - to perform the side-effects on mount/unmount.
      • useRef - to persist the original title across renders.
      import { useDocumentTitle } from '@tenedev/hooks';

      export function Dashboard() {
      useDocumentTitle('Dashboard', { template: '%s - MyApp' });

      return <h1>Dashboard</h1>;
      };

      0.2.0