On the Expressive Power of Hook-Indexed State Comprehending State in the React UI Library
Toby Ueno, Ezra Cooper, Simon Fowler, Sam Lindley
Key points
From the paper's conclusion- We then translate Lambda-React-Hook into a calculus Lambda-React-Ref based on ML-style references, and prove that this translation preserves typability and semantics, thus showing that hook-indexed state is expressible in terms of standard references.
Abstract
React is currently the most popular JavaScript library for front-end web development. It endows UI components with state via the useState construct, through a mechanism that we name hook-indexed state. However, React's implementation of hook-indexed state is both fragile and poorly understood. Programmers frequently experience unexpected behavior, and the benefits of programming in this paradigm are wholly unclear. We define Lambda-React-Hook, a core calculus that captures the essence of hook-indexed state, and give it a type system to statically rule out unexpected behavior. We then translate Lambda-React-Hook into a calculus Lambda-React-Ref based on ML-style references, and prove that this translation preserves typability and semantics, thus showing that hook-indexed state is expressible in terms of standard references. The translation is local and admits a compositional definition, but involves significant code duplication. As well as illuminating the essence of state in React, our observations can inform the design of future reactive programming systems.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Timeline: Adding the Time Dimension to SpreadsheetsProceedings of the ACM on Programming Languages · 2026
- Composing CRDTs Convergent by ConstructionProceedings of the ACM on Programming Languages · 2026
- Record Types EverywherearXiv · 2026
- Commit-Window Observation Contracts for Reactive Entity-Component SystemsProceedings of the ACM on Programming Languages · 2026
- A Design Space Exploration of Async/AwaitarXiv · 2026
- Typed Compositional Quantum Computation with LensesJournal of Automated Reasoning · 2026