import React, { useEffect, useState } from "react"; import { ArrowRightIcon } from "@heroicons/react/24/solid"; type Props = { value: number; }; const ProgressBar = ({ value }: Props) => { const percentageValue = `${(value * 100).toFixed(0)}%`; const [newValue, setNewValue] = useState(0.77); useEffect(() => { setInterval(() => { // randomizing value between value and 1 setNewValue(Math.random() * (1 - value) + value); }, 3000); }, [value]); const percentageNewValue = `${(newValue * 100).toFixed(0)}%`; return (
{percentageValue} {percentageNewValue}
); }; export default ProgressBar;