Immer
UI library · Free
Builds immutable state from convenient draft mutations, reducing manual copying of nested objects in reducers and stores.
Also known as: immerjs/immer; immerjs; immer-state; immutable-state-management

What you can use for free
Code and local use under MIT.
Paid features and costs
Computing resources, self-hosting, and external services are paid for separately if used.
Access and limitations
Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.
Use cases
- Simplify immutable updates to nested state
- Describe draft changes and compare the resulting immutable state
Example workflow
A possible workflow; this is not a report of hands-on testing.
Simplify immutable updates to nested state.
Before you start
- The original nested state and a reducer that currently copies modified branches manually.
- Project code using Immer and reference examples of state changes.
Steps
- Choose a reducer that manually copies nested objects.
- Describe draft changes and compare the resulting immutable state.
- Check the original and new state; separately check external objects from the closure and the constraints of a unidirectional tree.
Check your result
- Check that the recipe produces the expected new state and that original data is preserved in reference examples.
- Check for cycles and repeated occurrences of one object in the tree; modify external data through a separate copy.
Choosing Immer
Simplify immutable updates to nested state
Choose this when
- Simplify immutable updates to nested state
- Describe draft changes and compare the resulting immutable state
Consider alternatives when
- When choosing for this topic, compare Immer with Jotai. A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
- When choosing for this topic, compare Immer with Valtio. A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
Requirements
- Use a unidirectional tree: an object must not appear in the state twice, and cyclic references are not supported.
Things to consider
- Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
- Terms of use: MIT for the code; dependencies have separate licenses.
- An object from outside the recipe does not automatically become a draft; changing it may affect original data.
Frequently asked questions
What can you use for free in Immer?
Code and local use under MIT.
What additional costs might arise with Immer?
Computing resources, self-hosting, and external services are paid for separately if used.
What terms of use matter for Immer?
MIT for the code; dependencies have separate licenses.
How do you get started with Immer?
Choose a reducer that manually copies nested objects. Describe draft changes and compare the resulting immutable state. Check the original and new state; separately check external objects from the closure and the constraints of a unidirectional tree.
Can an object from a closure be safely modified inside produce?
Not automatically. The documentation warns that external data does not undergo draft conversion simply because it is assigned inside a draft. Do not modify the original object through such a reference; create a separate copy first if needed.
Related tasks and approaches
- Jotai
A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
- Valtio
A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
- Zustand
A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
License
MIT for the code; dependencies have separate licenses.
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsTechnologies and topics
- Immer
- UI
- Development