react-animated-numbers
react-animated-numbers copied to clipboard
Getting useinsertion effect not a function when using react-animated-numbers
I am getting useinsertion effect not a function when using react-animated-numbers Attaching SS for same
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;