Skip to content

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

@Mohitkumar6122

Description

@Mohitkumar6122

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions