Skip to content

Is it possible to "assign" multiple times within a single "action"? #1775

Answered by davidkpiano
Sheldonfrith asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the pure() action creator to do multiple assigns, but it sounds like you might not need to:

actions: assign({
  someActors: () => {
    return [/* array of things */].map(thing => spawn(createSomeMachine(thing)))
  }
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sheldonfrith
Comment options

Answer selected by Sheldonfrith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants