Skip to content

Dependencies on useMachine #1751

Answered by davidkpiano
Ghirigoro asked this question in Q&A
Dec 20, 2020 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

This isn't an easy question to answer. Right now, it's expected that the machine is static - it should be the same for the lifetime of the component. It's like the component's "brain"; it should be deterministic logic that handles all possible states.

Analogy: you have a single brain that handles your behavior when you're awake and when you're asleep; you don't swap an "asleep brain" for an "awake brain".

Now, if useMachine were to allow dynamic machines, what should be the expected behavior of a machine changing in-flight? If it tries to keep the current state as the machine changes, then that state may be an impossible state for the new machine, and be completely incompatible with it.

O…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Andarist
Comment options

@davidkpiano
Comment options

Answer selected by Andarist
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants