#createActorContext interpreter options
1 messages · Page 1 of 1 (latest)
You can use withConfig.
createActorContext(machine.withConfig(options))
Awesome thanks Farzad 🙂
hmm I'm seeing
Argument of type '{ devTools: boolean; }' is not assignable to parameter of type 'InternalMachineOptions.....```
for
const s = createMachine({}).withConfig({ devTools: true });
export const SearchContext = createActorContext(s);
Should the {devTool: true} not be the second parameter to createMachine(...) i.e. createMachine({},{devTool:true}).withContext(...)
No. In fact I was wrong too. devTools is an interpreter option and not a machine option.
I don't think there's a way to pass interpreter options to createActorContext's interpreter. I might open a PR to address that.
Actually I was thinking of useMachine not createMachine like this const [state, send, service] = useMachine(registrationFormMachine, { devTools: true }); My bad
Yeah, useMachine accepts that.
Fixing here https://github.com/statelyai/xstate/pull/3804
This is merged and will be available with the next version of @xstate/react.
fabulous! ⭐
This is released ✅
Is there still no way to pass/override options to an interpreted machine that is created outside of react?
I usually I find that I need access to the same actor (interpreted machine) from inside and outside of components, but that's not possible right?