The fact that useMachine “creates” the machine means that we can only create a machine inside an component. This problematic because...
- You can't define a mahine outside the component (eg)
- You can't get the type of the (created) machine outside the component (which is required for context, eg)
createDefinition solves 1 but doesn't solve 2 so we need something like xstate ie let m = createMachine(d); then later in component useMachine(m). We could add an overload to do useMachine(d) which saves users from writing useMachine(createMachine(d))
The fact that
useMachine“creates” the machine means that we can only create a machine inside an component. This problematic because...createDefinitionsolves 1 but doesn't solve 2 so we need something like xstate ielet m = createMachine(d);then later in componentuseMachine(m). We could add an overload to douseMachine(d)which saves users from writinguseMachine(createMachine(d))