官术网_书友最值得收藏!

Props

JSX is very convenient when your DOM elements or React components have props. Using XML is pretty easy to set attributes on elements:

  <img src="https://www.dev.education/images/logo.png" alt="DEV  
Education" />

The equivalent in JavaScript would be as follows:

  React.createElement("img", { 
src: "https://www.dev.education/images/logo.png",
alt: "DEV Education"
});

This is far less readable, and even with only a couple of attributes it is harder to read without a bit of reasoning.

主站蜘蛛池模板: 南平市| 丰宁| 昆山市| 汤阴县| 万载县| 扬州市| 绩溪县| 钦州市| 丹巴县| 当阳市| 南投县| 浠水县| 桐柏县| 车致| 泗水县| 孝义市| 正定县| 南陵县| 蛟河市| 墨竹工卡县| 临澧县| 巨野县| 涡阳县| 榆林市| 会理县| 西峡县| 深圳市| 烟台市| 和平县| 拉孜县| 康平县| 兰溪市| 安陆市| 汶上县| 深泽县| 邢台县| 错那县| 江北区| 枣庄市| 准格尔旗| 清徐县|