Context
When action handlers are defined as traditional function expressions, they are executed with an action context. This context is useful to call child actions. Array function expressions does not have their own binding. They share the parent scope. It is impossible to call them with the action context. For this reason, the context is passed as a property named context in the first argument of the handler.
Usage
To call a child action inside the handler using an arrow function, the context property is used:
nikita
// Call a parent action using arrow function
.call(({context}) => {
// Call a child action
context.call(() => true)
})Alternatively, with the traditional function expression, the this scope can be used:
nikita
// Handler with the tradional function expression and `this`
.call(function() {
// Call a child action
this.call(() => {
// Handler implementation
})
})