phanpy/src/utils/useTitle.js

10 lines
241 B
JavaScript
Raw Normal View History

2022-12-10 12:14:48 +03:00
import { useEffect } from 'preact/hooks';
const { VITE_CLIENT_NAME: CLIENT_NAME } = import.meta.env;
export default (title) => {
useEffect(() => {
document.title = title ? `${title} - ${CLIENT_NAME}` : CLIENT_NAME;
}, [title]);
};