`react-smooth` is a declarative animation library for React applications, providing components like `Animate` and `AnimateGroup` to facilitate property-based and keyframe-based animations. The current stable version is 4.0.4, which updates peer dependencies to support React 19. The library also supports previous React versions from 16.8 onwards. While its release cadence can be somewhat irregular, it ensures compatibility with modern React ecosystems. Key differentiators include its declarative API for defining animations directly within JSX, support for custom easing functions (Bezier, Spring), and its association with the Recharts library, where it is often used for data visualization animations. It abstracts away complex browser animation APIs, allowing developers to focus on animation logic rather than low-level implementation details. The library ships with TypeScript types, facilitating safer development practices.
npm install react-smoothVerified import paths — ran on the pinned version, not inferred.
This example demonstrates a basic mount/unmount animation using the `Animate` component with a render prop pattern, toggling its visibility and applying a fade-in and slide-in effect. It showcases `from`, `to`, `duration`, and `easing` props with a functional child component for styling.
Upgrade your project's React and React-DOM dependencies to version 16.8.0 or higher. For example, `npm install react@^18.0.0 react-dom@^18.0.0`.
Review any custom logic or configuration that explicitly interacts with `react-transition-group` APIs if you experience issues. Consult `react-transition-group` v4 documentation for breaking changes.
If you inadvertently installed version 4.0.2, downgrade to 4.0.1 or upgrade to 4.0.3+ immediately using `npm install react-smooth@4.0.1` or `npm install react-smooth@latest`.
Replace usages of `translateStyle` with modern CSS-in-JS solutions or post-processing tools that handle vendor prefixes, such as PostCSS with Autoprefixer, or update your styles manually if prefixes are critical for specific targets.
Ensure React and React-DOM are at least version 16.8.0 and that you don't have multiple copies of React bundled. Check your component structure to ensure Hooks (even indirectly used by `react-smooth` components) are within functional components.
Always use `className` instead of `class` when specifying CSS classes for DOM elements within JSX. Review your code for `<div class="my-class" />` and change it to `<div className="my-class" />`.
Implement conditional rendering or optional chaining (`?.`) to ensure that data is available before `react-smooth` components attempt to process it. For example, `{data && <AnimateGroup>{data.map(...) }</AnimateGroup>}`.