License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2020.12
URN: urn:nbn:de:0030-drops-131697
URL: http://dagstuhl.sunsite.rwth-aachen.de/volltexte/2020/13169/
Go to the corresponding LIPIcs Volume Portal


Madsen, Magnus ; Lhoták, Ondřej ; Tip, Frank

A Semantics for the Essence of React

pdf-format:
LIPIcs-ECOOP-2020-12.pdf (0.8 MB)


Abstract

Traditionally, web applications have been written as HTML pages with embedded JavaScript code that implements dynamic and interactive features by manipulating the Document Object Model (DOM) through a low-level browser API. However, this unprincipled approach leads to code that is brittle, difficult to understand, non-modular, and does not facilitate incremental update of user-interfaces in response to state changes.
React is a popular framework for constructing web applications that aims to overcome these problems. React applications are written in a declarative and object-oriented style, and consist of components that are organized in a tree structure. Each component has a set of properties representing input parameters, a state consisting of values that may vary over time, and a render method that declaratively specifies the subcomponents of the component. React’s concept of reconciliation determines the impact of state changes and updates the user-interface incrementally by selective mounting and unmounting of subcomponents. At designated points, the React framework invokes lifecycle hooks that enable programmers to perform actions outside the framework such as acquiring and releasing resources needed by a component.
These mechanisms exhibit considerable complexity, but, to our knowledge, no formal specification of React’s semantics exists. This paper presents a small-step operational semantics that captures the essence of React, as a first step towards a long-term goal of developing automatic tools for program understanding, automatic testing, and bug finding for React web applications. To demonstrate that key operations such as mounting, unmounting, and reconciliation terminate, we define the notion of a well-behaved component and prove that well-behavedness is preserved by these operations.

BibTeX - Entry

@InProceedings{madsen_et_al:LIPIcs:2020:13169,
  author =	{Magnus Madsen and Ondřej Lhot{\'a}k and Frank Tip},
  title =	{{A Semantics for the Essence of React}},
  booktitle =	{34th European Conference on Object-Oriented Programming (ECOOP 2020)},
  pages =	{12:1--12:26},
  series =	{Leibniz International Proceedings in Informatics (LIPIcs)},
  ISBN =	{978-3-95977-154-2},
  ISSN =	{1868-8969},
  year =	{2020},
  volume =	{166},
  editor =	{Robert Hirschfeld and Tobias Pape},
  publisher =	{Schloss Dagstuhl--Leibniz-Zentrum f{\"u}r Informatik},
  address =	{Dagstuhl, Germany},
  URL =		{https://drops.dagstuhl.de/opus/volltexte/2020/13169},
  URN =		{urn:nbn:de:0030-drops-131697},
  doi =		{10.4230/LIPIcs.ECOOP.2020.12},
  annote =	{Keywords: JavaScript, React, operational semantics, lifecycle, reconciliation}
}

Keywords: JavaScript, React, operational semantics, lifecycle, reconciliation
Collection: 34th European Conference on Object-Oriented Programming (ECOOP 2020)
Issue Date: 2020
Date of publication: 06.11.2020


DROPS-Home | Fulltext Search | Imprint | Privacy Published by LZI