- React Design Patterns and Best Practices(Second Edition)
- Carlos Santana Roldán
- 64字
- 2021-06-24 15:43:37
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.
推薦閱讀
- 物聯(lián)網(wǎng)(IoT)基礎(chǔ):網(wǎng)絡(luò)技術(shù)+協(xié)議+用例
- Building Django 2.0 Web Applications
- Learning QGIS 2.0
- 物聯(lián)網(wǎng)關(guān)鍵技術(shù)及應(yīng)用
- Web Application Development with R Using Shiny
- HTML5 Game development with ImpactJS
- Microservice Patterns and Best Practices
- 網(wǎng)管第一課:網(wǎng)絡(luò)操作系統(tǒng)與配置管理
- 人人都該都懂的互聯(lián)網(wǎng)思維
- Learning Node.js Development
- 5G時代的大數(shù)據(jù)技術(shù)架構(gòu)和關(guān)鍵技術(shù)詳解
- 園區(qū)網(wǎng)絡(luò)架構(gòu)與技術(shù)
- Dart Cookbook
- 物聯(lián)網(wǎng)技術(shù)與實踐
- 企業(yè)網(wǎng)絡(luò)組建與維護(hù)項目式教程