- 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}
/>
推薦閱讀
- 物聯網短距離無線通信技術應用與開發
- OpenLayers Cookbook
- 中國互聯網發展報告2018
- Learning Swift(Second Edition)
- Kong網關:入門、實戰與進階
- Unity Artificial Intelligence Programming
- 網絡安全應急響應技術實戰指南
- 轉化:提升網站流量和轉化率的技巧
- bash網絡安全運維
- 精通SEO:100%網站流量提升密碼
- Migrating to Drupal7
- Building Microservices with Spring
- 萬物互聯:物聯網核心技術與安全
- 互聯網視覺設計(全彩慕課版)
- Twilio Cookbook(Second Edition)