Skip to content

Destroy/Clean up a machine stopped in an arbitrary moment (eg, React DOM unmount) #1825

Answered by VanTanev
VanTanev asked this question in Q&A
Discussion options

You must be logged in to vote

@Andarist suggested the proper solution here:

const machineCreator = () => createMachine({
  context: {
    tabLock: new TabLock()
  },
  exit: (ctx) => ctx.tabLock.destroy()
})

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@VanTanev
Comment options

@VanTanev
Comment options

@Andarist
Comment options

@VanTanev
Comment options

@Andarist
Comment options

Comment options

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

@VanTanev
Comment options

Answer selected by VanTanev
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