#on state entry, update context

1 messages · Page 1 of 1 (latest)

mild halo
#

I want to be able to call action calculateScore and have it update the machine context
The state looks like this:

     "Evaluate": {
                    entry: ['calculateScore'],
                    type: "final"
      }

Trying to use assign which has no effect

actions: {
    calculateScore: (context, event) => {
                    assign({
                        score: (context, event) => evaluateScore(context, event)
                    })
                }
    }

what's the proper way to accomplish that?

cursive fjord
#

assign() just returns an object; this will not do anything. Let's change this:

#
actions: {
  calculateScore: assign({
    score: (ctx, ev) => { ... }
  })
}