
Company News
Socket Named to Rising in Cyber 2026 List of Top Cybersecurity Startups
Socket was named to the Rising in Cyber 2026 list, recognizing 30 private cybersecurity startups selected by CISOs and security executives.
@custom-react-hooks/use-document-title
Advanced tools
`useDocumentTitle` is a custom React hook for dynamically setting the document title. It updates the title shown in the browser tab, enhancing the user experience by reflecting the current page or content state.
useDocumentTitle is a custom React hook for dynamically setting the document title. It updates the title shown in the browser tab, enhancing the user experience by reflecting the current page or content state.
document object.Choose and install individual hooks that suit your project needs, or install the entire collection for a full suite of utilities.
npm install @custom-react-hooks/use-document-title
or
yarn add @custom-react-hooks/use-document-title
npm install @custom-react-hooks/all
or
yarn add @custom-react-hooks/all
The useDocumentTitle hook must be imported using a named import as shown below:
Named Import:
import { useDocumentTitle } from '@custom-react-hooks/use-document-title';
This approach ensures that the hook integrates seamlessly into your project, maintaining consistency and predictability in how you use our package.
import React, { useState } from 'react';
import { useDocumentTitle } from '@custom-react-hooks/all';
const DocumentTitleComponent = () => {
const [title, setTitle] = useState('My Awesome Page');
useDocumentTitle(title);
return (
<div>
<h1>Welcome to My Awesome Page</h1>
<button
onClick={(e) => {
setTitle('Clicked on the button');
}}
>
Click on the button
</button>
<button
onClick={(e) => {
setTitle('My Awesome Page');
}}
>
Restore title name
</button>
</div>
);
};
export default DocumentTitleComponent;
In this example, the hook is used to set the document title to "My Awesome Page" when DocumentTitleComponent is rendered.
title: The string to set as the document title.revertOnUnmount: (optional) A boolean that determines whether to revert to the original title on component unmount.Your contributions to improve useDocumentTitle are appreciated. Feel free to submit issues or pull requests to enhance its functionality and usability.
FAQs
`useDocumentTitle` is a custom React hook for dynamically setting the document title. It updates the title shown in the browser tab, enhancing the user experience by reflecting the current page or content state.
The npm package @custom-react-hooks/use-document-title receives a total of 498 weekly downloads. As such, @custom-react-hooks/use-document-title popularity was classified as not popular.
We found that @custom-react-hooks/use-document-title demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket was named to the Rising in Cyber 2026 list, recognizing 30 private cybersecurity startups selected by CISOs and security executives.

Research
Socket detected 84 compromised TanStack npm package artifacts modified with suspected CI credential-stealing malware.

Security News
A dispute over fsnotify maintainer access set off supply chain alarms around one of Go’s most widely used filesystem libraries.