a tool for shared writing and social publishing
at main 425 B view raw
1import { useEffect, useState } from "react"; 2 3export function DotLoader() { 4 let [dots, setDots] = useState(1); 5 useEffect(() => { 6 let id = setInterval(() => { 7 setDots((count) => (count + 1) % 4); 8 }, 250); 9 return () => { 10 clearInterval(id); 11 }; 12 }, []); 13 return ( 14 <div className="w-[26px] h-[24px] text-center text-sm"> 15 {".".repeat(dots) + "\u00a0".repeat(3 - dots)} 16 </div> 17 ); 18}