【24h】

A Semantics for the Essence of React

机译:作出反应本质的语义

获取原文
       

摘要

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. Reacta??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 Reacta??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.
机译:传统上,Web应用程序已被编写为HTML页面,其中包含嵌入式JavaScript代码通过使用低级浏览器API操纵文档对象模型(DOM)来实现动态和交互功能。然而,这种未经警告的方法导致代码是易碎的,难以理解,非模块化,并且不符合响应状态变化的用户界面的增量更新。 React是构建旨在克服这些问题的Web应用程序的流行框架。 React应用程序以声明性和面向对象的样式编写,并由在树结构中组织的组件组成。每个组件都具有一组代表输入参数的属性,该状态由可能随时间变化的值而组成的状态,以及声明地指定组件的子组件的渲染方法。 Refta ??的对帐概念确定状态更改的影响并通过选择性安装和卸载子组件来逐步更新用户界面。在指定点处,React框架调用生命周期挂钩,使程序员能够在框架之外执行操作,例如获取和释放组件所需的资源。这些机制表现出相当大的复杂性,但对于我们的知识,没有反应的语义的正式规范存在。本文介绍了一个小型操作语义,捕获反应的本质,作为迈向开发用于编程理解,自动测试和Bug寻找React Web应用程序的自动工具的长期目标的第一步。为了证明安装,卸载和和解等关键操作,我们定义了乖巧的组件的概念,并证明这些操作保留了良好的行为。

著录项

获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号