Things get hairy in both, but redux pattern feels so ridiculously ceremonial all to effectively manage a huge global state object with a false sense of "purity".
Observables otoh say "fuck it, I'm mutating everything, do what you want with it".
Things get hairy in both, but redux pattern feels so ridiculously ceremonial all to effectively manage a huge global state object with a false sense of "purity".
Observables otoh say "fuck it, I'm mutating everything, do what you want with it".
```
// define observable
this.count = this.observable(0);
// getting
this.count.value;
// setting
this.count.update(value => value + 1);
```
But it also has a redux-like pattern where you can dispatch actions and register reducers with far less ceremony:
```
// define store
const todoStore = createStore({ todos: [], });
// register reducer / producer
todoStore.register('add', (store, payload) => { store.todos.push(payload); });
// subscribe component to store
this.todos = this.subscribe(todoStore, 'todos');
// dispatch
this.dispatch("add", newTodo);
```
It looks like it’s mutating, but both the reducers and update() uses immer* under the hood, so we still respect immutability under the hood.
Cami supports redux devtools so you can use that for time-travel debugging too.
—-
Will the V8 JIT optimize the hash based function table loop into a constant integer array lookup?