A machine is data: { states: { idle: { on: { FETCH: "loading" } }, ... } }. A transition is either a target name or { target, guard }, where guard(context) must return true for it to apply. Write transition(config, state, event, context), which returns the next state name, or the same state when the event is not handled or its guard fails. Also write availableEvents(config, state, context), which lists the events that would currently do something. Both throw Error("Unknown state: " + name) for a state the config does not have.