|
|
|
|
|
by daneburkland
2215 days ago
|
|
What do you do inside of the then and error blocks? _That_ is what this post (and state machines) are concerned with. Passing messages to a single entity (reducer in this case) that decides how to handle them, rather than spreading that logic across components, event handlers etc. In terms of boilerplate, libraries like Xstate do a great job on that front. The goal here is to provide a from-the-ground-up overview of using explicit state machines. |
|
We can still contain the logic on how to handle that request in a single function:
I don’t think explicit state machine orchestration helps app architecture when we have been succinctly achieving the same thing with way less needlessness.So I guess a lot of my frustration is that this stuff is literally in someone’s bootstrapped todo app right now, or crud app. The normalization of articles like this in effect normalized code like this everywhere. I’d like to at least just yell back a little to reverse some of these trends that got adopted with little thought about trade offs.
In other words, don’t even think about reaching for the explicit state machine scaffolding if all you really want to do is use immutable data and a fetch request. Ironically, the thing that needs to be explicitly declared is this warning.