Replace empty components with hooks (#666)

This commit is contained in:
mrdrogdrog 2020-10-12 22:33:23 +02:00 committed by GitHub
parent 9e9108ec9a
commit 0d2c2fe0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 24 deletions

View file

@ -0,0 +1,11 @@
import { useEffect } from 'react'
import { useSelector } from 'react-redux'
import { ApplicationState } from '../../redux'
export const useDocumentTitle = (title?: string):void => {
const brandingName = useSelector((state: ApplicationState) => state.config.branding.name)
useEffect(() => {
document.title = `${title ? title + ' - ' : ''}HedgeDoc ${brandingName ? ` @ ${brandingName}` : ''}`
}, [brandingName, title])
}