- React Design Patterns and Best Practices(Second Edition)
- Carlos Santana Roldán
- 142字
- 2021-06-24 15:43:37
Hello, World!
Now that our environment has been set up to support JSX, we can dive into the most basic example: generating a div element.
This is how you would create a div element with React's createElement function:
React.createElement('div')
And this is the JSX for creating a div element:
<div />
It looks similar to regular HTML.
The big difference is that we are writing the markup inside a .js file, but it is important to note that JSX is only syntactic sugar, and it gets transpiled into JavaScript before being executed in the browser.
In fact, our <div /> element is translated into React.createElement('div') when we run Babel, which is something we should always keep in mind when we write our templates.
推薦閱讀
- 社交網(wǎng)絡(luò)對齊
- 解析QUIC/HTTP3:未來互聯(lián)網(wǎng)的基石
- Mastering Machine Learning for Penetration Testing
- EDA技術(shù)與VHDL編程
- Force.com Development Blueprints
- Learning Karaf Cellar
- HCNA網(wǎng)絡(luò)技術(shù)
- 信息通信網(wǎng)絡(luò)建設(shè)安全管理概要2
- 6G無線網(wǎng)絡(luò)空口關(guān)鍵技術(shù)
- 深入理解OpenStack Neutron
- 深入理解Nginx:模塊開發(fā)與架構(gòu)解析
- 組網(wǎng)技術(shù)與網(wǎng)絡(luò)管理
- 沖擊:5G如何改變世界
- 人際網(wǎng)絡(luò)
- 現(xiàn)場綜合化網(wǎng)絡(luò)運營與維護:運營商數(shù)字化轉(zhuǎn)型技術(shù)與實踐