![[React] React Fundamentals: JSX Deep Dive [React] React Fundamentals: JSX Deep Dive](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
"JSX transforms from an XML-like syntax into native JavaScript. XML elements and attributes are transformed into function calls and objects, respectively."
Input:
React.createClass({
render: function(){
var style = {
backgroundColor: '#ccc',
color: blue
};
return (
<div >
<a href="#" style={style}/> {/*This is comment*/} Thisis message
{/*JSX don't have if else*/}
{i > 1 ? 'More than one' : 'one'}
{i>1&& 'More than one' }
</div>
)
}
})
output:
React.createClass({
render: function(){
var style = {
backgroundColor: '#ccc',
color: blue
};
return (
React.createElement("div", null,
React.createElement("a", {href: "#", style: style}), " ", /*This is comment*/" Thisis message",
/*JSX don't have if else*/
i > 1 ? 'More than one' : 'one',
i>1&& 'More than one'
)
)
}
})