Open Newbie012 opened 3 years ago
@Newbie012 Agree! The fact that we don't support factory machines is not exactly great, since they're a fantastic way to use XState.
@Andarist's PR will support this, though. Pretty much all the issues on the board are due to the Babel-based extraction mechanism, which #29 will replace entirely.
Following the Reddit tutorial, there's a section that demonstrates splitting machines. In that section, they create a factory that creates a machine given a subreddit name. This is my translation to typescript
As you may guess,
xstate-codegen
has an issue with it since we're not exporting the machine. The only thing that I can come up with is:createMachine
outside of the function and export it.context.subreddit
as optional.createSubredditMachine
to:The only thing that bugs me is that I had to set the
subreddit
as optional. Is there a better way of handling this?