'use client';

import { useEffect, useRef } from 'react';

export function useTitle() {
    const titleCounter = useRef<number>(0);

    useEffect(() => {
        const title = document.head.querySelector('title');

        if (!title) return;

        const titleTimer = setInterval(() => {
            if (titleCounter.current === 0) {
                title.innerHTML = '# Stephen Matheis';
                titleCounter.current = 1;

                return;
            }

            if (titleCounter.current === 1) {
                title.innerHTML = '# Stephen Matheis';
                titleCounter.current = 0;

                return;
            }
        }, 1000);

        return () => {
            titleCounter.current = 0;
            clearInterval(titleTimer);
        };
    }, []);
}
# Pages

[Home](/)
[Index](/index)
[Docs](/docs)