WhoBuilt

XState ❤️ NoNav - Taking Back Control Of Navigation

Oct 21, 2020· 23 min· 1.2K views·Watch on YouTube

Speaker

Yann Leflour, deputy CTO at French mobile app development agency BAM, presents at React Native EU 2020 on using XState and React NoNav to make React Native navigation more declarative and context-aware.

How navigation inherited the web’s structure

Leflour traces navigation from physical information systems, such as finding a book by shelf and page, to hierarchical file systems and web links. As websites became interactive, single-page apps shifted routing, display components, and session state toward the client.

Why imperative navigation gets in the way

Leflour maps navigation onto Flux: components display state, while navigation actions update a stack managed by a library. Passing destination page names can couple pages to each other, and a separate navigation service can turn navigation into a side effect. In his Dropbox login and folder-picker example, adding navigation links many parts of the app.

NoNav puts the user’s context first

Leflour argues that mobile apps do not need to preserve the web’s page-and-stack model. The NoNav concept, coined by BAM design lead Caroline Benner, prioritizes product needs and faster access to features. Messenger reduced its navigation from eight tabs across two bars to three tabs, while Uber used four journey-specific home pages to avoid navigation.

React NoNav handles transitions declaratively

React NoNav, published by Thomas Pucci, separates transitions from the app’s own state. Its canal component handles transitions between children, while screen components declare their display state. Leflour says this lets the app maintain a single source of truth for navigation state.

XState models journeys and their context

Leflour uses XState to compute screen changes from events and context, avoiding nested conditions as journeys grow. He describes states, events, transitions, context, services, and actions, and shows how nested and parallel machines can isolate reusable flows such as login and folder selection. His recommendation is to use React Navigation for declarative transitions and XState for context and complex journeys.

Takeaways

  • Keep navigation state in a source of truth the app controls.
  • Avoid making one page responsible for naming its next page.
  • Use device and journey context to surface relevant features sooner.
  • Model complex journeys with state machines instead of growing nested conditions.
  • Separate screen transitions from the business logic that decides what should be shown.

Mentioned in this talk

Search inside this talk

What was claimed 9

Related talks