pkgdocs/compare/framer-motion vs immer

Comparing

npm

framer-motion

Production-ready animations and gestures for React — declarative, physics-based, with layout animations and exit transitions.

7.0M/ wk
v12.6.2
vs
npm

immer

Create your next immutable state by mutating the current one

41.7M/ wk
v11.1.4
Metricframer-motionimmer
Ecosystemnpmnpm
DifficultyIntermediateBeginner ✓
Weekly downloads7.0M41.7M↑
Latest versionv12.6.2v11.1.4
Recipes2↑1

Tags

framer-motion only

animationgesturesuimotion

Shared

react

immer only

immutablestatereduxmutationsmutablecopy-on-writetypescriptimmutablesreducer

When to use each

framer-motion

React apps needing UI animations: page transitions, list reordering, drag-and-drop, hover effects, scroll-triggered reveals, and exit animations.

immer

Use Immer whenever you have deeply nested state updates that are painful to write immutably: Redux reducers, Zustand's set function, or React useState with complex objects. It's built into Redux Toolkit's createSlice, so you're probably already using it.

When to skip each

framer-motion

Non-React projects, performance-critical animations running at 120fps with many particles (use CSS or WebGL), or very simple opacity/transform transitions where CSS is sufficient.

immer

For flat, simple state (a counter, a boolean toggle), immer's overhead isn't worth it — just spread the object. Immer also has edge cases with classes, Maps, and Sets that require using enableMapSet() and enableAllPlugins().

Sample recipes

framer-motion

  • Fade and slide in on mount
  • Stagger-animate a list of items

immer

  • Install immer