Capítulo 20 de 142

Chapter 20: How to install Motion for React

Core Idea

Learn to install and set up Motion in your React project.

Key Concepts

  • Prerequisites: Before you install Motion
  • Install via package manager: The most common way of installing Motion is via a package manager.
  • npm: Once the package is installed
  • Yarn: Once the package is installed
  • pnpm: Once the package is installed
  • Add via CDN: It's also possible to import Motion directly from an external CDN
  • Frameworks: Motion is designed to work seamlessly with modern React frameworks.
  • Next.js: Motion supports both the Next.js Page and App Routers.
  • Vite: No special configuration is needed with Vite.

Code Examples

npm install motion
  • What it demonstrates: Core usage pattern for How to install Motion for React.

Key Takeaways

  1. Package managers like npm, Yarn and pnpm.
  2. CDN via jsDelivr.
  3. Frameworks like Next.js and Vite.

Connects To

  • Motion for React: Get started - React Animation Library: related Motion doc page.
  • React motion component: related Motion doc page.
  • Custom cursor & follow-cursor animations: related Motion doc page.
  • React Animation: related Motion doc page.