use-document-title

A React hook that sets the current title of the document.

Basic Usage

import useDocumentTitle from '@tanem/use-document-title'
import React from 'react'
import ReactDOM from 'react-dom'

const App = ({ title }) => {
  useDocumentTitle(title)
  return <div />
}

ReactDOM.render(<App title="New title" />, document.getElementById('root'))

Live Examples

API

Arguments

  • title - The new title of the document.

Example

useDocumentTitle('New title')

Installation

$ npm install @tanem/use-document-title --save

There are also UMD builds available via unpkg:

For the non-minified development version, make sure you have already included:

For the minified production version, make sure you have already included:

GitHub