React概念:声明式

You’ll run across articles describing React as a declarative approach to building UIs.

您将遍历描述React作为构建UI声明性方法的文章。

React made its “declarative approach” quite popular and upfront so it permeated the frontend world along with React.

React使它的“声明式方法”非常流行和前期,因此它与React一起渗透到前端世界。

It’s really not a new concept, but React took building UIs a lot more declaratively than with HTML templates:

这实际上不是一个新概念,但React声明性地构建UI的方式比使用HTML模板要多:

  • you can build Web interfaces without even touching the DOM directly

    您甚至无需直接接触DOM就可以构建Web界面
  • you can have an event system without having to interact with the actual DOM Events.

    您可以拥有一个事件系统,而不必与实际的DOM事件进行交互。

The opposite of declarative is imperative. A common example of an imperative approach is looking up elements in the DOM using jQuery or DOM events. You tell the browser exactly what to do, instead of telling it what you need.

声明的反义性势在必行 。 命令式方法的一个常见示例是使用jQuery或DOM事件在DOM中查找元素。 您告诉浏览器确切的操作,而不是告诉浏览器您需要什么。

The React declarative approach abstracts that for us. We just tell React we want a component to be rendered in a specific way, and we never have to interact with the DOM to reference it later.

React声明式方法为我们抽象了这一点。 我们只是告诉React我们希望组件以特定的方式呈现,并且我们以后不必再与DOM交互来引用它。

翻译自: https://flaviocopes.com/react-declarative/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值