mirror of
https://github.com/streamich/react-use.git
synced 2026-01-25 14:17:16 +00:00
12 lines
236 B
TypeScript
12 lines
236 B
TypeScript
import { useRef } from 'react';
|
|
|
|
function useTitle(title: string) {
|
|
const t = useRef<string>();
|
|
|
|
if (t.current !== title) {
|
|
document.title = t.current = title;
|
|
}
|
|
}
|
|
|
|
export default document ? useTitle : (_title: string) => {};
|