Skip to content
Myr

freezing.md

This file

Path

docs/freezing.md

19 lines · 1.4 KiB · Markdown

Last changed by

Added egghead.io video embedsMichel Weststratebefore adoptiona866760

History of this file

Take it

Show the source

freezing.md


id: freezing title: Auto freezing

egghead.io lesson 7: Immer automatically freezes data
Hosted on egghead.io

Immer automatically freezes any state trees that are modified using produce. This protects against accidental modifications of the state tree outside of a producer. This comes with a performance impact, so it is recommended to disable this option in production. By default, it is turned on during local development and turned off in production. Use setAutoFreeze(true / false) to explicitly turn this feature on or off.

⚠️ If auto freezing is enabled, recipes are not entirely side-effect free: Any plain object or array that ends up in the produced result, will be frozen, even when these objects were not frozen before the start of the producer! ⚠️