官术网_书友最值得收藏!

Wait, what is JSX?

You may not know what JSX is, but if you do, feel free to skip this. Otherwise, I'm going to provide a very quick summary for you!

To put it simply, JSX is just a mixture of JavaScript and HTML that functions essentially as a templating language. This is a bit of a simplified explanation; JSX is actually some smart syntax wrappers around calls to React.createElement, but put together in a way that more closely resembles HTML. This way, we can write interface code that is incredibly similar to HTML, which allows developers, designers, and others to work with our code (assuming they're already comfortable working with HTML), but we also get access to a few extra features since it is a JavaScript -based templating language.

The first bit of functionality that we get is that we can actually embed any JavaScript statements inside of any JSX by wrapping it in curly brackets! A gotcha to this, though, is that we need to remember that JSX is JavaScript first, and as a result there are some words and syntax here and there are are reserved (class being the prime example of this), so there are specific variations you'll need to use when writing JSX (such as className).

主站蜘蛛池模板: 宁陕县| 牡丹江市| 洞头县| 白银市| 阳江市| 临桂县| 广昌县| 微博| 大兴区| 庆元县| 南开区| 德保县| 驻马店市| 清丰县| 安徽省| 曲水县| 南江县| 铜陵市| 南郑县| 通河县| 五指山市| 达拉特旗| 诸暨市| 扶余县| 宜春市| 广东省| 达尔| 卢龙县| 荣成市| 当阳市| 陵水| 德州市| 缙云县| 武胜县| 错那县| 綦江县| 西安市| 女性| 容城县| 喀喇沁旗| 临城县|