I understand that the usage of useMachine on a component is useful for not handling these steps: interpreting, starting the machine, subscribing, updating the state and stopping the machine once the component is destroyed.
But why should it not be possible to do it on a service as well? Yeah, the service is a long-lived singleton that does not get destroyed. But all the other steps before mentioned are still a valid concern to address.
Is there a technical reason for not performing such steps on a service?
Hello there!
I understand that the usage of
useMachine
on a component is useful for not handling these steps: interpreting, starting the machine, subscribing, updating the state and stopping the machine once the component is destroyed.But why should it not be possible to do it on a service as well? Yeah, the service is a long-lived singleton that does not get destroyed. But all the other steps before mentioned are still a valid concern to address.
Is there a technical reason for not performing such steps on a service?