Design Patterns · Middle · Question 14 of 75

Why does immutable state simplify the Memento pattern?

Explanation

With mutations, a memento requires a deep copy. With immutable updates (spread, Immer), unchanged parts are reused (structural sharing), and change history costs almost nothing. That's how time travel in Redux DevTools works.

Further reading

Problem with a question

Design Patterns · Middle · question 14

Test yourself

Take the Design Patterns · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz