Inline Actions vs Actions In Machine Options
const countingMachine = createMachine({
initial: "counting",
context: { count: 0 },
states: {
counting: {
on: {
INCREMENT: {
actions: assign({
count: (context) => context.count + 1,
}),
},
},
},
},
});const countingMachine = createMachine({
initial: "counting",
context: { count: 0 },
states: {
counting: {
on: {
INCREMENT: {
actions: 'incrementCount',
},
},
},
},
},
{
actions: {
incrementCount: assign({
count: (context) => context.count + 1,
}),
},
});Last updated