import { useEffect , useState } from 'react' ; export function useDocumentTitle ( initTitle ) { const [ title , setTile ] = useState ( initTitle ) ; useEffect ( ( ) => { document . title = title ; } , [ title ] ) ; return { setTile , title } ; }