1.0.13 • Published 10 months ago

react-metered-count v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

React Metered Count

Count goes up

Installation

Install react-metered-count with npm

  npm install react-metered-count

Usage/Examples

import React, { useEffect, useState } from "react";
import { ScrolledCount } from "react-metered-count";

function App() {
  const [count, setCount] = useState(0);

  // Your count state change logic here
  // example snippet below.
  // This increments the count by 1
  // every 1000 milliseconds
  useEffect(() => {
    const timerReference = setInterval(() => {
      setCount((prev) => prev + 1);
    }, 1000);

    return () => {
      clearInterval(timerReference);
    };
  }, []);

  return (
    <>
      {/* returns in format 0 */}
      <ScrolledCount />
      {/* or */}
      <ScrolledCount fontSize={36} separator={"_"} count={count} />
    </>
  );
}

API Reference

ParameterTypeDescriptionDefault
fontSizenumberOptional. font size of count80
separatorstringOptional. Separator between three digits','
countnumberOptional. The count to increment & display0

Authors

1.0.13

10 months ago

1.0.11

10 months ago

1.0.12

10 months ago

1.0.2

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.10

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago