Skip to content
Discussion options

You must be logged in to vote

This is how I do it with hooks and contexts:

I have a separate systems folder where I keep all the machines and hooks and contexts related to it. For example, let's say I want to have a state machine to be used inside of home page or for pages/index.js, Then I'll create a folder at this location: src/systems/universe/home and this folder will contain 3 files:

  1. states.yaml - YAML representation of state machine.
  2. options.js - A file that simply exports an object with keys actions, activities, guards and services.
  3. index.js - contains variables to be exported so that this machine is usable across components (sharable, and independent services both).

This is how they look like:

states.yaml - …

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
2 replies
@eliorivero
Comment options

@Andarist
Comment options

Comment options

You must be logged in to vote
8 replies
@tomByrer
Comment options

@Takhine
Comment options

@a-y-u-s-h
Comment options

@Takhine
Comment options

@a-y-u-s-h
Comment options

Answer selected by eliorivero
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants