1.0.13 • Published 1 year ago

react-metered-count v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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

1 year ago

1.0.11

1 year ago

1.0.12

1 year ago

1.0.2

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.10

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago