- React Design Patterns and Best Practices(Second Edition)
- Carlos Santana Roldán
- 82字
- 2021-06-24 15:43:39
Multi-properties
A common problem in writing JSX comes when an element has multiples attributes. One solution is to write all the attributes on the same line, but this would lead to very long lines that we do not want in our code (see the following section for how to enforce coding style guides).
A common solution is to write each attribute on a new line, with one level of indentation, and then align the closing bracket with the opening tag:
<button
foo="bar"
veryLongPropertyName="baz"
onSomething={this.handleSomething}
/>
推薦閱讀
- 黑客攻防實戰技術完全手冊:掃描、嗅探、入侵與防御
- Modern JavaScript Web Development Cookbook
- Building E-commerce Sites with VirtueMart Cookbook
- 智能網聯汽車V2X與智能網聯設施I2X
- 電子政務效益的經濟分析與評價
- Spring Boot 2.0 Projects
- 物聯網之魂:物聯網協議與物聯網操作系統
- 物聯網+BIM:構建數字孿生的未來
- Proxmox High Availability
- 正在爆發的互聯網革命
- 網絡的琴弦:玩轉IP看監控
- 區塊鏈技術與應用:打造分布式商業新生態
- Building Microservices with Spring
- 物聯網商業設計與案例
- Learning AWS(Second Edition)