react-animated-numbers icon indicating copy to clipboard operation
react-animated-numbers copied to clipboard

Getting useinsertion effect not a function when using react-animated-numbers

Open Mohitkumar6122 opened this issue 5 months ago • 0 comments

I am getting useinsertion effect not a function when using react-animated-numbers Attaching SS for same

image

import dynamic from "next/dynamic";
import { useEffect, useState } from "react";
const AnimatedNumbers = dynamic(() => import("react-animated-numbers"), {
  ssr: false
});

const Sample = (props) => {
  const [num, setNum] = useState<number>(3331213);
  const [a, seta] = useState(false);

  return (
    <>
      <AnimatedNumbers
        includeComma
        className={"animated-price"}
        transitions={(index) => ({
          type: "spring",
          duration: index + 0.3,
        })}
        animateToNumber={num}
        fontStyle={{
          fontSize: 40,
          color: "red",
        }}
      />
      <div>
        <button onClick={() => setNum((state) => state + 100)}>+</button>
        <button onClick={() => setNum((state) => state - 31234)}>-</button>
      </div>{" "}
      <style jsx>
        {`
          .animated-price {
            color: green
          }
        `}
      </style>
      ;
    </>
  );
};

export default Sample;

Mohitkumar6122 avatar Sep 16 '24 14:09 Mohitkumar6122