Generated by XState Viz: https://xstate.js.org/viz
✓ Published0🌍 Public
Aadamscott
Last edited Mar 16, 2021
Created on Mar 16, 2021
This example shows a login state machine built with XState, modeled as an explicit statechart with idle, loading, success, and failure states. It demonstrates asynchronous data fetching by invoking a `fetchJwt` function that retrieves a JSON Web Token from a remote URL. The machine uses the `invoke` property with `onDone` and `onError` transitions, assigning the returned user data or an error to the context via the `assign` action. The visualization, generated by XState Viz, renders the statechart diagram from the `machine.js` source file, highlighting how state transitions and async side effects are encoded in the machine definition.
AI-generated description