Small functional React component for counting numbers up to a certain value in a specified duration in ms. Useful for creating animated dashboards etc.
Uses React hooks useEffect, useState and useRef. Good example on how to pass props to a useEffect hook without declaring them as dependencies and how to deal with setInterval in functional components.
<CounterFunc countFrom={0} countTo={123} durationMs={400} />