- React Design Patterns and Best Practices(Second Edition)
- Carlos Santana Roldán
- 200字
- 2021-06-24 15:43:36
JSX
In the previous chapter, we saw how React changes the concept of separation of concerns, moving the boundaries inside components. We also learned how React uses the elements returned by the components to display the UI on the screen.
Let's now look at how we can declare our elements inside our components.
React provides two ways to define our elements. The first one is by using JavaScript functions, and the second one is by using JSX, an optional XML-like syntax. Here is the examples section of the official React.js website (https://reactjs.org/#examples):

To begin with, JSX is one of the main reasons why people fail to approach React, because looking at the examples on the home page and seeing JavaScript mixed with HTML for the first time seems strange to most of us.
As soon as we get used to it, we realize that it is very convenient, precisely because it is similar to HTML and looks very familiar to anyone who has already created UIs on the web. The opening and closing tags make it easier to represent nested trees of elements, something that would have been unreadable and hard to maintain using plain JavaScript.
- 智慧城市:大數據、互聯網時代的城市治理(第4版)
- Mastering Node.js(Second Edition)
- 連接未來:從古登堡到谷歌的網絡革命
- 工業控制網絡安全技術與實踐
- 計算機網絡安全實訓教程(第二版)
- Spring Cloud微服務架構進階
- Go Web Scraping Quick Start Guide
- 2018網信發展報告
- NB-IoT物聯網技術解析與案例詳解
- 數字調制解調技術的MATLAB與FPGA實現:Altera/Verilog版(第2版)
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 網絡基礎與網絡管理項目化教程
- 互聯網+思維與創新:通往未來的+號
- 異構蜂窩網絡關鍵理論與技術
- Selenium WebDriver 3 Practical Guide