Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@chappy/use-document-title

peterchappy2MIT1.0.1TypeScript support: included

a react hook for setting up a document title

react, hook, typescript

readme

@chappy/use-document-title

CircleCI

React hook for setting the document title

Install

yarn add @chappy/use-document-title
npm install @chappy/use-document-title

Usage

import { useDocumentTitle } from "@chappy/use-document-title";

const Foo = () => {
  useDocumentTitle({ title: "Page Title" });
  return <div />;
};

Arguments

useDocumentTitle({
  title: string
  revertOnUnmount: boolean
})
  • title: string The title you want to set the document to. useDocumentTitle observers this as a dependency.
  • revertOnUnmount: boolean Will revert to previous title on unmount.