{renderApplicationPicker()}
{activeApplication &&
}
);
};
```
---
Storing spawned applications and their data in a state machine separately from the UI has a number of advantages
over a traditional data-in-components implementation:
1. Applications can process data in the background even when their components are unmounted
2. Application services and their data is stored by the application manager and can be persisted and restored
without any external data mechanism.
3. The UI framework layer (e.g., React) becomes a plain view layer; logic and side-effects are not tied directly
to the UI, except where it is appropriate.
4. Business logic is testable independent of UI
---
### A New State of Mind
Whether you have written state machines before, there are always state machines in our code, either implicit or
explicit.
Implicit ones are generally harder to maintain, visualize and get right. In theory, an explicit state machine can
help developers optimize for correctness and clarity in their code.
---
### Considerations
* It's a new set of tools and terminology: When to use a parallel state? What is an interpreter and a service?
* It increases the lines of code for smaller implementations especially
* It's a different programming model, everyone is used to standard if/else conditional statements and there can be
a lot of *a boolean is much simpler!* arguments between developers.
---
### Investigating Further
There are excellent resources on both statecharts and xstate that I would recommend exploring if you're interested
in the topic:
* [xstate docs](https://xstate.js.org/docs/)
* [statechart model docs](https://statecharts.github.io/)