@chappy/use-document-title

a react hook for setting up a document title

Usage no npm install needed!

<script type="module">
  import chappyUseDocumentTitle from 'https://cdn.skypack.dev/@chappy/use-document-title';
</script>

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.