|
|
|
|
|
by atmin
3767 days ago
|
|
Thanks for the insightful explanation. Adding https://github.com/atmin/freak to the comparison (disclaimer, I'm the author): * it supports set operations, `model(‘fieldName’, newValue)`, like Backbone and unlike Redux, which trigger only the necessary update actions in the (implicitly built) dependency graph. set is idempotent, even if your computed properties have side effects * it has .on() method * "You can log every action and see the entire state tree before and after the action.”. In freak, too: const model = freak(statePOJO);
const history = [];
model.on(‘change’, prop => {
// change is called exactly once per mutation
history.push({...model.values});
});
freak’s README is a literal test suite, consisting of state changes and assertions.Probably it's a good idea to add 'beforeChange' event, to make it possible to cancel a mutation. * it's currently implemented internally using mutable data structure, but this is implementation detail and can be changed to immutable data in the future, allowing simply `history.push(model.values)` |
|