# Immer now works with Aurelia store

**URL:** <https://discourse.aurelia.io/t/immer-now-works-with-aurelia-store/3702>\
**Category:** Framework Knowledge\
**Created:** [August 9, 2020, 3:54pm UTC](https://discourse.aurelia.io/t/immer-now-works-with-aurelia-store/3702 "2020-08-09T15:54:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jenselme](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jenselme/32/39_2.png) [@Jenselme](https://discourse.aurelia.io/u/Jenselme)\
**Post date:** [August 9, 2020, 3:54pm UTC](https://discourse.aurelia.io/t/immer-now-works-with-aurelia-store/3702/1 "2020-08-09T15:54:10Z")

</div>

As noted by Kalle [on the discord](https://discord.com/channels/448698263508615178/506757962388209664/735059350149922936) with the new release of ImmerJS, you can now use it correctly with Aurelia store. In a nutshell:

1. Disable auto-freeze with `setAutoFreeze(false);`
2. Write your actions like this:

```auto
export const selectBackend = produce((state: State, selectedBackend: SelectableBackend) => {
    state.selectedBackend = selectedBackend;
});

```

1. Only modify the state directly: immer will track its modification to create a new object but won’t modify the existing one. If you modify any other parameter directly, it will be mutated.

If you need more details, I wrote [a detailed blog post](https://www.jujens.eu/posts/en/2020/Aug/09/aurelia-store-immerjs/).

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [August 9, 2020, 5:29pm UTC](https://discourse.aurelia.io/t/immer-now-works-with-aurelia-store/3702/2 "2020-08-09T17:29:17Z")

</div>

Thanks for the update and the great detailed blog post @Jenselme. Might want to submit it to [https://www.aureliaweekly.com/](https://www.aureliaweekly.com/) in order to reach a larger audience.

---

<div class="post-metadata">

**Author:** ![HamedFathi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hamedfathi/32/2099_2.png) [@HamedFathi](https://discourse.aurelia.io/u/HamedFathi)\
**Post date:** [August 9, 2020, 6:01pm UTC](https://discourse.aurelia.io/t/immer-now-works-with-aurelia-store/3702/3 "2020-08-09T18:01:34Z")

</div>

@Jenselme Well done!  
@zewa666 Interesting 🤣

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/3/3641a7b005828d204b4950ae990370f22d8af343.png)

So, Friends, before Vildan and I come to you, submit your articles to Aurelia weekly 😛 😂 😈
