Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const loadAnimationAsync = async (_name: string) => {
try {
const animationData = await import(/* webpackChunkName: "animation/[request]" */ `../../../../public/animations/${_name}.json`);
lottie.loadAnimation({
container: container.current, // the dom element that will contain the animation
renderer: 'svg',
loop: true,
autoplay: true,
animationData,
});
} catch (error) {
// tslint:disable-next-line:no-console
console.error('Error loading animation');
}
};