If I'm not mistaken, this will not freeze the state of an app, because passed parameters are references and this.todoItems copies a reference. Thus after some time reference source changes and so does my final this.todoItems.
There should be a kind of clone with a new object creation. Doing it in reducer is not obvious and can be source of errors. State class is a better place to my mind.
In your article (part 2) there is a State class example:
public class AppState { public final List todoItems;
public final TodoFilter filter;
}
If I'm not mistaken, this will not freeze the state of an app, because passed parameters are references and this.todoItems copies a reference. Thus after some time reference source changes and so does my final this.todoItems.
There should be a kind of clone with a new object creation. Doing it in reducer is not obvious and can be source of errors. State class is a better place to my mind.