1

The scenario: when onEntry to the submit state it fires a defined saveData action. This action persists the form data, the catch is I can’t get access to the data although if I hardcode a dataset object and use that it works. I can see the data I need is located in machine._state but this is private and I can't figure out how to access it. Could someone tell me how, please?

[saveData]: assign((ctx, ev) => {
        const { machines = {}, data, form, } = ctx;
        const { order } = form;
        const index = 0;
        const currentStep = order[index];
        const machine = machines[currentStep]; //machine has a private _state that I need access to
}),

enter image description here

chris loughnane
  • 2,648
  • 4
  • 33
  • 54
  • Can you share a full code example? Are the machines in ctx.machines spawned? – David Khourshid Dec 31 '20 at 18:59
  • I'm sorry, the code base is at work and I can't access it for 3 days. I am new to xState and although I looked up "spawn" in the docs I still can't answer your question. I added a screenshot I had in a chat that shows the data exists in the context. If that helps any... – chris loughnane Jan 01 '21 at 02:51

0 Answers0