Immer
Immer is a JavaScript library that enables immutable state updates through mutable draft views, producing modified copies with structural sharing.
Secrets of the JavaScript Ninja, Third Edition
Immer is a JavaScript library that enables immutable updates by presenting mutable draft views and producing modified copies with structural sharing.
- How it is used
- Creates modified copies of immutable collections through mutation-style updates.
- How deep it goes
- Explains draft creation and Proxy-based copy construction, without detailing Immer’s internal copy algorithm.
- Examples
- Demonstrates adding an array item and updating Map data in a read-only TypeScript state.
- What you can do after
- Apply Immer’s `produce` function to create modified copies of read-only collection state.
Read how Secrets of the JavaScript Ninja, Third Edition explains Immer →
React in Depth
Immer is a JavaScript library that lets code express immutable state updates through drafts that can be modified directly.
- How it is used
- Simplifies immutable reducer updates when nested objects and arrays make manual copying cumbersome.
- How deep it goes
- Explains draft mutation, proxy-based change recording, and immutable playback, but stops short of detailing the implementation internals.
- Examples
- Demonstrates updating a nested done array with manual copying and then with produce().
- What you can do after
- Apply it via produce() to write reducers that mutate drafts while returning immutable state updates.
Related concepts
- Redux Toolkitused by · Redux Toolkit is the officially recommended Redux package providing utilities and conventions for configuring stores, defining reducers, and managing middleware.
- XStateused by · XState is a JavaScript library for modeling application logic with state machines and statecharts.
- zustandused by · Zustand is a lightweight JavaScript state-management library that provides centralized stores and hooks for sharing application state.
Questions about Immer
What is Immer?
Immer is a JavaScript library that enables immutable state updates through mutable draft views, producing modified copies with structural sharing.
Which Manning books explain Immer?
Secrets of the JavaScript Ninja, Third Edition and React in Depth.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

