I am using LottieFiles in React v18, vite v4. In public I keep a .lottie
file which I am loading with <DotLottieReact/>
. Sometimes animation can't load. In console I have message: Uncaught DOMException: Index or size is negative or greater than the allowed amount
.
How can I solve it?
What is the problem?
//Animation.jsx
import React from 'react';
import { DotLottieReact } from '@lottiefiles/dotlottie-react';
export const Animation = ({url="path/to/animation.lottie"}) => {
return (
<DotLottieReact
src={url}
loop
autoplay
/>
);
};
//SecondSection.jsx
<div>
<Animation url="./crown.lottie"/>
</div>