Capítulo 11 de 142

Chapter 11: Animate numbers

Core Idea

Animate numbers in React with a 2.5kb component: counters, countdowns, live pricing and stats, with locale-aware number formatting.

Key Concepts

  • Features: First
  • Install: First
  • Customise animation: The transition prop accepts Motion for React's transition options.

Code Examples

<AnimateNumber>{count}</AnimateNumber>
  • What it demonstrates: Core usage pattern for Animate numbers.

Key Takeaways

  1. **Built on Motion: **Leverages Motion's robust animation engine, allowing you to use f.
  2. Lightweight: Adds only 2.5kb on top of Motion.
  3. Advanced formatting: Uses the built-in Intl.NumberFormat for powerful, locale-aware .
  4. **Customisable: **Provides distinct CSS classes for each part of the number.

Connects To

  • Install Motion+ for React: related Motion doc page.
  • React transitions: related Motion doc page.