useDocumentTitle


An easy way to set the title of the current document.

Usage

import { useDocumentTitle } from 'reactchemy'

export default function Component() {
   useDocumentTitle('foo bar')
}

Hook

import { useIsomorphicLayoutEffect } from 'reactchemy'

export function useDocumentTitle(title: string): void {
   useIsomorphicLayoutEffect(() => {
      window.document.title = title
   }, [title])
}