import { memo, useEffect, useState } from 'react'; interface LoadingDotsProps { text: string; } export const LoadingDots = memo(({ text }: LoadingDotsProps) => { const [dotCount, setDotCount] = useState(0); useEffect(() => { const interval = setInterval(() => { setDotCount((prevDotCount) => (prevDotCount + 1) % 4); }, 500); return () => clearInterval(interval); }, []); return (
{text} {'.'.repeat(dotCount)} ...
); });