Learning on Web Dev Open is free for all.

ArcadeStatechart
Arcade

Statechart

Phase 04 · Framework InternalsPlayable

Fill in a transition table until every recorded session ends where it should.

0 / 5 cleared
Level 1 · A disclosure

Closed and open, one event. Clicking repeatedly should keep flipping it.

Transitions: click a cell to change where it goes
stateTOGGLE
closedstart
open

· means the event is ignored in that state, which is a decision, not a gap.

Recorded sessions
  • one clickclosed ≠ open
    TOGGLE
  • two clicksclosed
    TOGGLE → TOGGLE
  • five clicksclosed ≠ open
    TOGGLE → TOGGLE → TOGGLE → TOGGLE → TOGGLE

The table you fill in here is the same thing as a reducer’s switch statement, and the sessions are replayed through it exactly as a user’s clicks would be. Anything a session cannot reach is a state your component cannot get into.