Hey all, I'm having problems sending events to spawned machine when using React Context. Player is stuck in "loading" state all the time and I'm unable to send any events to it. Please see here https://codesandbox.io/s/zen-fast-8sq7yn?file=/src/App.tsx
#Unable to send events to spawned child machine
1 messages · Page 1 of 1 (latest)
This is strange but a workaround is to do this:
const { playlistService } = usePlaylistContext();
const ref = useSelector(playlistService, (state) => state.context.ref);
const [state, send] = useActor(ref!);
useEffect(() => {
send("LOADED");
}, [send]);
See the use of useSelector instead?
Hey David, just tried this approach but seems to be the same
I'm able to get the state to "start" in "ready": https://codesandbox.io/s/naughty-aryabhata-nuvkjs?file=/src/App.tsx:203-423