本文共 1202 字,大约阅读时间需要 4 分钟。
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模板要多:
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交互来引用它。
翻译自:
转载地址:http://wvqgb.baihongyu.com/