Skip to content
Version: XState v4

History states

A history state returns the parent state to its most recently active child state. The box with an H inside represents the history state.

The history state can be deep or shallow:

  • A shallow history state remembers the immediate child‚Äôs state.
  • A deep history state remembers the deepest active state or states inside its child states.

Make a state a history state‚Äč

First, select the state you want to set as a history state for the parent state. Then…

Using the¬†quick actions¬†menu‚Äč

  1. Right-click the state to bring up the quick actions menu.
  2. Choose History from the Type options.

Using the¬†State details¬†panel‚Äč

  1. Select the state you want to set as the final state.
  2. Open the State details panel from the right tool menu.
  3. Choose History from the Type dropdown menu.
  4. Use the History toggle that appears when the state has a History Type to choose between Shallow and Deep history options.