useDocumentTitle
Set a document title and restore the previous owner on cleanup.
The most recently mounted enabled hook owns the title. Updating that owner updates the title; removing it restores the remaining owner or the original title, even if owners unmount out of order.
Usage
Examples
Playground
API
2 options
1 return value
Accessibility
Use concise page titles that identify the current content. Avoid rapidly changing titles or announcing pointer movement.
Notes
- Use framework metadata for server-rendered page titles. This hook handles client-owned surfaces.
Related
useIsClientFalse on the server and during hydration, true on the client.useIsMobileTrue below the 768px phone breakpoint.useIsMountedA stable getter for whether this hook is currently mounted.useMediaQueryTrack a CSS media query, SSR-safe.useOnlineStatusWhether the browser reports a network connection.usePageVisibilityWhether the tab is visible, to pause work in the background.