react-lottie is a React component that wraps `bodymovin.js` (now known as Lottie Web) to render animations exported from Adobe After Effects as JSON. The current stable version, 1.2.10, was released in 2018. It allows developers to integrate vector animations into React applications, offering programmatic control over playback (play, pause, stop), and supporting various After Effects features like shape layers, masks, and trim paths. Its key differentiators include enabling interactive animations with small file sizes, and the ability to load animation data from local assets or remote APIs. However, due to its age and lack of maintenance, developers should be aware of potential compatibility issues with modern React versions and ecosystem changes, making newer alternatives a more robust choice for contemporary projects.
npm install react-lottieVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to embed and control a Lottie animation using the `react-lottie` component, including play, pause, and stop functionality, with basic state management.
For new projects or if encountering issues with newer React versions, strongly consider using actively maintained alternatives such as `@lottiefiles/react-lottie-player` or `lottie-react` which provide better compatibility and features.
There is no direct fix within `react-lottie` itself. The best approach is to migrate to a modern Lottie player for React that adheres to current React best practices and lifecycle conventions.
Monitor performance metrics and consider profiling animations. If performance is a critical concern, newer libraries or direct `lottie-web` integration might offer better control and optimization opportunities.
Be aware that external resources and community support for 'bodymovin.js' specifically may be scarce. When searching for solutions or understanding features, focus on 'lottie-web' documentation, understanding that `react-lottie` wraps an older version of it.
Ensure that your `.json` animation file is correctly imported (e.g., `import * as animationData from './myAnimation.json'`) and passed as `animationData: animationData` within the `options` prop object.
This is a warning originating from the unmaintained library itself and doesn't directly indicate a problem with your code. While it's often harmless, for a clean console and future compatibility, migrating to a different, actively maintained Lottie player for React is recommended.
First, ensure `npm install --save react-lottie` or `yarn add react-lottie` has been run. If the issue persists, check your bundler (Webpack, Rollup, Vite) configuration to ensure it correctly handles CommonJS modules from `node_modules`.