How to use the xstate.spawn function in xstate

To help you get started, we’ve selected a few xstate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coodoo / xstate-examples / _old / fsm-service-3-actor / src / fsm / mainActions.js View on Github external
export const addJobAssign = assign((ctx, e) => {
	const { song } = e
	// feeding in inital context for the child actor
	// notice it's not `machine.withConfig()`
	song.actor = spawn( WorkerMachine.withContext(song) )
	ctx.songs.push(song)
	return ctx
})