Repolode
immerjs

immerjs/immer

A JavaScript library that lets you write immutable state updates by mutating a draft copy of the current state.

Stars
28,988
Forks
901
Open issues
46
Last commit
12 hours ago

What is it?

Immer lets developers update immutable state by writing ordinary mutating code. Changes are made to a draft proxy of the current state, and Immer produces a new immutable state tree while leaving the original untouched. This removes the need to manually copy nested objects and arrays when updating state.

The library is commonly used with Redux reducers and other state-management code where immutable updates are required. Its API centers on a produce function that takes a base state and a recipe function, and it is distributed as the npm package immer. Documentation is hosted on the project's website.

Key features

  • 01Write state updates by mutating a draft instead of copying objects manually.
  • 02Produces new immutable state while leaving the original state unchanged.
  • 03Core API is a produce function that takes a base state and a recipe.
  • 04Distributed as the npm package immer.

Use cases

  • Simplifying immutable updates in Redux reducers.
  • Updating deeply nested state in React or other UI applications.
  • Writing state logic that needs undo history or change tracking through immutable snapshots.

Quick start

  1. 1

    Read the documentation at immerjs.github.io/immer to find install instructions

  2. 2

    To contribute, open the project in Gitpod, which installs dependencies and runs yarn run start automatically

Topics

FAQ

What is immer?
A JavaScript library that lets you write immutable state updates by mutating a draft copy of the current state. Immer lets developers update immutable state by writing ordinary mutating code. Changes are made to a draft proxy of the current state, and Immer produces a new immutable state tree while leaving the original untouched. This removes the need to manually copy nested objects and arrays when updating state.
Is immer free to use? What license does it have?
immer is open source under the MIT license. Check the license terms before using it in commercial products.
Is immer still maintained?
Actively maintained. The last commit to immer was on Oct 21, 2026.
What can I use immer for?
Simplifying immutable updates in Redux reducers. Updating deeply nested state in React or other UI applications. Writing state logic that needs undo history or change tracking through immutable snapshots.
How do I install immer?
Read the documentation at immerjs.github.io/immer to find install instructions To contribute, open the project in Gitpod, which installs dependencies and runs yarn run start automatically
Where can I get immer?
The source code and installation instructions are on GitHub: https://github.com/immerjs/immer

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects