# useDots a "loading state" helper. Add loading dots to some text ## Visual Example  ## Example ```tsx import * as React from "react"; import { useDots } from "@casperiv/useful/hooks/useDots"; const Component = () => { const [isLoading, setLoading] = React.useState(false); React.useEffect(() => { const timeout = setTimeout(() => { setLoading(false); }, 5_000); return () => { clearTimeout(timeout); }; }, []); // only update dots when loading. // This is important so the component doesn't re-render when not needed! const dots = useDots(isLoading); if (isLoading) { return
Loading{dots}
; } returnLoading complete!
; }; ```