Wire machines together declaratively. When the source machine enters the specified state, sends an event to the target machine.
Returns a cleanup function to tear down the connection.
hub.connect({ from: 'auth', enters: 'loggedOut', to: 'checkout', send: 'RESET', }) Copy
hub.connect({ from: 'auth', enters: 'loggedOut', to: 'checkout', send: 'RESET', })
Returns a machine by key, fully typed.
const auth = hub.get('auth') auth.send('LOGIN', { user: 'admin' }) Copy
const auth = hub.get('auth') auth.send('LOGIN', { user: 'admin' })
Wire machines together declaratively. When the source machine enters the specified state, sends an event to the target machine.
Returns a cleanup function to tear down the connection.