@tanem/use-document-title

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

Usage no npm install needed!

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

README

use-document-title

npm version build status coverage status npm downloads minzipped size

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:

License

MIT