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

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.

主站蜘蛛池模板: 娄底市| 襄樊市| 湘潭市| 都昌县| 赫章县| 沾化县| 平陆县| 昆明市| 新密市| 河曲县| 中江县| 虎林市| 南华县| 天镇县| 崇阳县| 呼伦贝尔市| 敖汉旗| 金乡县| 临夏市| 瓮安县| 九龙城区| 临邑县| 仁化县| 黑水县| 南木林县| 大城县| 万荣县| 佳木斯市| 栖霞市| 南靖县| 临城县| 定日县| 宁陕县| 凤山市| 定远县| 上杭县| 张家港市| 陇川县| 清流县| 鹤壁市| 丹阳市|