3 ms·
> In my mind the single best thing about Redux is the use of event sourcing for all application state changes. I hate to be picking nits here, but unless you'r
by karmajunkie 9y ago
> In my mind the single best thing about Redux is the use of event sourcing for all application state changes.
I hate to be picking nits here, but unless you're actually storing those events, and rebuilding state from those, its not eventsourcing. We already have to deal with a lot of confounded terminology in that space, please don't add to the confusion.
- deleted 9y ago[deleted]
- dismantlethesun 9y agoI don't use Redux, but I presumed that the events were stored by default, and state was rebuilt from them during 'time travel' debugging. In a production environment, rebuilding from the stored events is less necessary, and only specialised applications such as rich text editors (e.g. really use it).
- leshow 9y agoEvents aren't stored by default. You can store them, and it sure makes creating those types of applications easier, but that's more because you've bought at least partially into referential transparency and pure functions in your reducers. More apps than the ones you mentioned benefit from this though, any undo or revert operation in an applications is leagues easier in the sort of FRP design of redux.
- acemarke 9y agoRedux's core doesn't store any events or prior state by default. It just does: currentState = rootReducer(currentState, action); Time travel debugging is implemented as a store enhancer, which does indeed save the action history and replay it to generate the correct state as you jump between specific points in the history log. There's also many addons and additional use cases that can make use of recording actions as they occur, such as logging a user's session for later playback / debugging as part of a crash report, or implementing undo/redo functionality.
- couchand 9y agoYes you're technically correct (the best kind of correct). But I'd argue that if you're developing a Redux app without Redux Dev Tools you're doing it wrong, and Redux Dev Tools does indeed store the original sequence of events and give you Martin Fowler's three killer features: Complete Rebuild, Temporal Query, and Event Replay.
- karmajunkie 9y agoI don't know if I'd agree that "technically correct" is the best kind :) But I do agree that Redux Dev Tools are a great example of what you can do with ES. That's just not application level logic, so I don't think its fair to credit an application developer with applying ES just because a tool they use at development time (not at runtime) does so.