Utilizing the react-countup library to animate counting up to a specific value. When a user clicks a button, the generated value is 9.57, and through react-counter, it visually increments from 1.00 to 9.57 over time.
Here's the code snippet:
const { start } = useCountUp({
ref: countUpRef,
start: 1.00,
end: val[rand],
decimals:2,
decimal:".",
onReset: () => setRand(Math.floor(Math.random() * 10)),
});
return (
<VStack>
<Text ref={countUpRef} fontSize={val[rand] * 20} />
<Button
backgroundColor="#BB86FC"
borderRadius="25px"
_hover={{
bg: '#121212'
}}
_active={{
bg: '#121212'
}}
onClick={start}
>
New Value
</Button>
</VStack>
)
Question: Can the size of the text component be dynamically increased as the number animates from 1.00 to 9.57?