Skip to content

Instantly share code, notes, and snippets.

@jkjustjoshing
Last active September 4, 2019 20:39
Show Gist options
  • Save jkjustjoshing/419097c1a01d074f16ebfc2d3d71898c to your computer and use it in GitHub Desktop.
Save jkjustjoshing/419097c1a01d074f16ebfc2d3d71898c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'mfj-nav',
initial: 'national',
context: {
retries: 0
},
states: {
national: {
on: {
SELECT_STATE: 'state',
SELECT_MEASURE: 'measure'
}
},
state: {
on: {
SELECT_COUNTY: 'county',
SELECT_MEASURE: 'state_measure'
}
},
county: {
on: {
SELECT_MEASURE: 'county_measure'
}
},
county_measure: {
on: {
BACK: 'county'
}
},
measure: {
on: {
SELECT_STATE: 'state_measure'
},
initial: 'map_of_states',
states: {
map_of_states: {
on: {
SELECT_LEGAL_CONTEXT: 'legal_context'
}
},
legal_context: {
on: {
SELECT_MAP_OF_STATES: 'map_of_states'
}
}
}
},
state_measure: {
on: {
SELECT_COUNTY: 'county_measure'
}
}
}
});
function all () {
return {
on: {
CHANGE_TAB: { target: ['all_cases', 'race', 'sex', 'indigent_status', 'offense', 'related_measures', 'legal_context']}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment