Description
I am using a spawned actor as a prop, and then use that prop with the useService hook, similar to how the Reddit example with actors does it.
Expected Result
The return array of the useService hook would be valid.
Actual Result
TypeError
Cannot read property 'context' of undefined
Reproduction
Here is the code that is causing the error
Additional context
Love the library and the ideas. It's possible I'm doing something incorrectly here.
EDIT
Thanks for the speedy reply David. You鈥檙e awesome
Close! The context property doesn't work the same way as assign. Try this:
// ...
context: {
flightTypeList,
flightType: ONE_WAY_FLIGHT,
firstFlightInput: undefined,
secondFlightInput: undefined
},
entry: assign({
firstFlightInput: () => spawn(createFlightInputMachine(), 'firstFlightInput'),
secondFlightInput: () => spawn(createFlightInputMachine(), 'secondFlightInput')
}),
// ...
Most helpful comment
Close! The
contextproperty doesn't work the same way asassign. Try this: