~/talk

Building Complex UI with State Machines

Talkat React Alicante 2024 · 2024-09-19..09-21· [react, typescript]
slides:none on file

Implements an autocomplete search UI using xstate and TypeScript, modeling states for no-results, searching and selecting, invoking actors for keyboard input and async search, and simulating the machine visually. Adds debouncing via after transition (500ms) without extra code, wires guards/actions/assigns for typed events, and ends up with ~200 lines of machine code. Demo works: spinner, keyboard navigation, highlighted first result, and selection; contrasts with a fragile hooks-only implementation.

AI-written summary · about

  1. 0:00State machines for UI
  2. 2:18State machine terms
  3. 3:01Autocomplete UI with state
  4. 7:17Guards and actions in xstate
  5. 12:45State machine in code
  6. 19:09Keyboard interaction with actors
  7. 21:45State machine to React UI
  8. 24:15Debouncing with state transitions
  9. 26:47State machines vs React hooks
  10. 27:10Pros and cons of state machines
  11. 30:04Closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.