пва
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
const BASE_TITLE = 'Любимый Креатив — Изделия ручной работы'
|
||||
|
||||
let currentTitle: string = BASE_TITLE
|
||||
|
||||
export function usePageTitle(title: string | null) {
|
||||
useEffect(() => {
|
||||
currentTitle = title ? `${title} — Любимый Креатив` : BASE_TITLE
|
||||
document.title = currentTitle
|
||||
}, [title])
|
||||
}
|
||||
|
||||
export function usePageTitleReset() {
|
||||
const location = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
document.title = BASE_TITLE
|
||||
currentTitle = BASE_TITLE
|
||||
}, [location.pathname])
|
||||
}
|
||||
Reference in New Issue
Block a user