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

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.

主站蜘蛛池模板: 九龙县| 翼城县| 兴文县| 大姚县| 新津县| 五常市| 涞水县| 弥勒县| 忻州市| 博罗县| 南开区| 巫山县| 榆中县| 临湘市| 伊吾县| 牡丹江市| 宁河县| 东光县| 松阳县| 开平市| 岚皋县| 交口县| 尉氏县| 黄石市| 长顺县| 双峰县| 吕梁市| 玛曲县| 元谋县| 东安县| 林州市| 卓资县| 卓尼县| 加查县| 安多县| 新晃| 巴楚县| 夏津县| 鸡西市| 瑞安市| 新宾|