Skip to content

Immer

A JavaScript library that lets you update immutable state by writing ordinary mutating code.

Stars
29k
Forks
905
Licence
MIT
Language
JavaScript
Last update
6 days ago
Type
Library

What it is

Immer is a JavaScript library for managing state without changing it directly. You write code that looks like it modifies a draft of your data, and Immer produces a new immutable copy with only the changed parts updated. The README describes it as a way to create the next immutable state tree by simply modifying the current tree. The README excerpt provided does not describe its APIs in detail, so this summary is limited to its stated purpose and topics such as Redux and reducers.

  • Update nested fields in a state object in a reducer without manually copying each level
  • Produce new immutable state snapshots while keeping the original state unchanged

Great for

  • JavaScript developers who find hand-written immutable updates verbose or error-prone
  • Teams managing nested state in Redux-style reducers
  • Developers who want immutable data without learning a new state model

Not ideal for

  • Projects that do not use JavaScript or TypeScript, since this is a JavaScript library
  • Developers looking for a full state management framework, since the README presents Immer as a focused library for producing new state
Step-by-step guide: how to use ImmerInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js

    Install from npm

    npm install immer
  2. 2

    Run it

    • Install the package with npm.
    • Read the documentation at https://immerjs.github.io/immer/ for the core API.
    • Apply it to a state object in a reducer or update function and inspect the result.
  3. 3

    Get the most out of it

    • Read the official documentation for advanced usage and patterns.
    • Check the release notes at https://github.com/immerjs/immer/releases when upgrading.
    • Use it alongside Redux if your app already uses reducers, since the topics list it there.

Downloads

Strengths

  • Lets you write update code in a mutating style while keeping state immutable
  • Has a documentation site linked from the README
  • Open source under the MIT license with an active project history

Trade-offs

  • The README excerpt gives little detail on API usage or limits, so evaluation requires the full documentation
  • Immutable-update libraries add a dependency and a new pattern for teams to learn

How it compares

ProjectStarsTypeLevelUpdatedBest for
immer (this)29kLibrarybeginner6 days agoJavaScript developers who find hand-written immutable updates verbose or error-prone
immutable-js33kLibraryintermediate5 days agoJavaScript developers managing application state that is updated often
redux-toolkit11.2kLibraryintermediate4 days agoDevelopers already using or learning Redux for app state
redux61.4kLibraryintermediate16 days agoDevelopers building larger front-end apps where many components share the same data
zustand58.9kLibrarybeginner15 days agoReact developers who want simpler shared state than Redux
redux-saga22.4kLibraryintermediate12 days agoReact or other frontend developers already using Redux who need to manage async logic

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.