Immer

Create the next immutable state by mutating the current one (by immerjs)

Immer Alternatives

Similar projects and alternatives to Immer

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better Immer alternative or higher similarity.

Suggest an alternative to Immer

Reviews and mentions

Posts with mentions or reviews of Immer. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-12-02.
  • Immutable.js is not dead!
    6 projects | reddit.com/r/javascript | 2 Dec 2021
    *cradles immer in my arms*
  • Best way to update large sets of data for state changes
    1 project | reddit.com/r/reactjs | 2 Dec 2021
    Per another comment, the best tool for updating deeply nested state immutably is Immer: https://immerjs.github.io/immer/ . It will let you write this same "mutating" syntax (including the .splice() at the end), track the changes, and return a correctly immutably-updated result object as if you'd written a bunch of nested object spreads/array copies by hand.
  • How to get better and easier state management with Redux Toolkit
    11 projects | dev.to | 1 Dec 2021
    And that's right, that's how you should write immutable code, but Redux Toolkit uses under the hood the library Immer which will handle the changes and take care of the immutability for you.
  • 4x Smaller, 50x Faster
    12 projects | news.ycombinator.com | 29 Nov 2021
    To me, it is lazy to use immutable data structures in situations where they generate large amounts of garbage and/or result in user-facing GC pauses. (In Firefox, I encounter many slow sites (with or without immutability) with multi-frame pauses, often GC pauses. I think the slowdown is coming from the website and not my extensions.)

    I believe it's possible to understand the code you create, even in the presence of mutation (though you can no longer store old values for free, and need to use cloning or other approaches). You need to restrict which code is responsible for mutating state (using careful program architecture), and restrict the ability to mutate data while other pointers to the data exist (Rust imposes these restrictions). Interestingly, the Relm architecture is a translation of the Elm architecture (Elm is an immutable language) to Rust code (Rust is a mutable language) which restricts which code is responsible for mutating state, and Rust restricts the ability to mutate data while other pointers to the data exist.

    Interestingly, Rust unifies immutable and mutable data structures. The im library (https://docs.rs/im) uses the same tree-based immutable data structures as Clojure and such, but exposes an API closer to Rust's stdlib containers (including mutation). However im's performance characteristics are different from Rust's stdlib; clones are shallow and take O(1) time, while IndexMut is slower and copies tree nodes whenever that node's refcount is greater than 1. immer.js (https://github.com/immerjs/immer) has a somewhat similar API, but a different implementation (I think it uses standard JS arrays and copies the whole thing when you mutate one element).

  • Stop Overcomplicating your State – Try Zustand
    5 projects | dev.to | 30 Oct 2021
    Immer is another great package that makes reducing nested structures easy. We can create middleware to allow us to use immer easily. Here is a fully typed version.
  • nstate: a simple but powerful state management library
    1 project | reddit.com/r/reactjs | 17 Oct 2021
    Shipped with immer for nested state updating
  • Forever Functional: Immutable objects for safer state
    4 projects | dev.to | 13 Oct 2021
    Here we'll study the varied ways that JavaScript provides, such as object freezing and cloning, so we can get a basic understanding of what a full immutability solution needs. We won't try, however, to achieve 100% production-ready code, possibly dealing with getters, setters, private attributes, and more; for this I would rather suggest looking at available libraries such as Immutable, Immer, Seamless-immutable, and others.
  • What is Immutability and why I love it
    1 project | dev.to | 10 Oct 2021
    As with everything in the internet, you should never follow someones advice blindly! If you are not forced to write immutable code (e.g. when working with Redux), you can just do what feels right to you. It will take some time and effort to get used to it and I might be really frustrating not to use some functions which you just learned to use. But if you still like the approach, you will probably love Immer which is a JavaScript library which makes immutability super easy, because it lets use use mutable code and just takes care about the rest. Here is a cool blog post by the creator of Immer which tells you why he created it!
  • The Great Redux Toolkit Debate
    8 projects | dev.to | 30 Sep 2021
    createReducer — allows you to write a reducer without a switch statement. Uses Immer under the hood. Immer is amazing and you should use it in your reducers even if you don't plan to use Redux Toolkit.
  • Redux is Dead: Long Live Redux Toolkit
    1 project | dev.to | 27 Sep 2021
    For more information on how Immer works, feel free to visit its documentaion here.
  • Why didn’t my React / NextJS assignement cut it?
    3 projects | reddit.com/r/reactjs | 18 Sep 2021
    Or using immer
  • Electron Adventures: Episode 54: Notebook state management with useImmer
    2 projects | dev.to | 16 Sep 2021
    React is a lot more strict, and for what we need we cannot leave the state in individual components, we need to pull it up to the App component. Making modifications to deeply nested state is a lot of nasty code, fortunately React world has a solution - immer and its hooks version useImmer.
  • React-Redux Hooks With Typescript
    3 projects | reddit.com/r/programming | 8 Sep 2021
    Destructuring and recreating the state object per action within rootReducer works (e.g., {...state, name: action.payload.name || ''}), but as your reducers get more complicated, it can become unpleasant. That's where Immer helps: Immer lets you write normal mutating code (e.g., (draftState.name = action.payload.name || ''), then it takes care of figuring out how to represent that as a new object.
  • Managing complex nested state
    2 projects | reddit.com/r/reactjs | 8 Sep 2021
    Or use https://github.com/immerjs/immer and feel free to mutate it ;-)
  • How I got multiple FAANG offers in Europe
    1 project | dev.to | 31 Aug 2021
    Website applications got me interviews with Booking in the Netherlands, JP Morgan in the UK, Amazon in Germany, Microsoft in the US, Lyft in the US. Spamming recruiters worked with Uber in Netherlands and Databricks in the Netherlands. It also kind of worked with Microsoft, but Microsoft in Poland, that was not my area of interest. It was a bit complicated with my referral for Facebook. I reached out to Michel Weststrate, whom I knew as a creator of immer and mobx. He was a super-nice guy, and he referred me for a frontend role. I was immediately rejected. I decided not to give up, and asked my ex-colleague from Hazelcast, master of everything distributed, Ensar Basri Kahveci, for help. I sent him 3 different roles at Facebook I wanted to try - frontend in the UK, generic software engineer in the UK, and something else I don't even remember now. My thinking was that even if my first application for the frontend role was rejected, on a different day a different recruiter might be looking at a new pile of applications, and he might make a different decision about mine. As to the generic software engineer role, I thought that a totally different recruiter might deal with that role, so it was worth a try. On the next day, I connected on LinkedIn to a recruiter from Facebook in London. To my surprise and joy, he read my message! He told me that he saw the referral in the system, and initiated a call. My last referral that eventually worked came from Alex Salo - a god of math I met back in my uni days, who now works at Google. I say eventually because I did not have a reliable way to contact Alex, so by the time he referred me, I already maxed out the number of applications one could send to Google in a month. My website applications to Google, US, did not work. So after a month, in March, I tried to apply to Google, Germany, and Google, Switzerland, via Alex's link, and I got the interview!

Stats

Basic Immer repo stats
45
21,656
7.9
9 days ago

immerjs/immer is an open source project licensed under MIT License which is an OSI approved license.

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
Find remote JavaScript jobs at our new job board 99remotejobs.com. There are 16 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.