1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2024-12-23 19:00:15 +03:00
phanpy/src/utils/useTitle.js
2022-12-16 13:27:04 +08:00

9 lines
254 B
JavaScript

import { useEffect } from 'preact/hooks';
const { VITE_CLIENT_NAME: CLIENT_NAME } = import.meta.env;
export default function useTitle(title) {
useEffect(() => {
document.title = title ? `${title} / ${CLIENT_NAME}` : CLIENT_NAME;
}, [title]);
}