什么是jsx语法
我认为就是可以用来表示我们任何想表式的一种语法
表示变量
import React from "react";
class App extends React.Component {
constructor (){
super()
this.state ={
title:"hello world"
}
}
render() {
const element = "wxy"
return (
<div>
<h1>{element}</h1>
</div>
);
}
}
export default App
表示对象
...
render() {
const element = (
<h1 className="greeting">
Hello, world!
</h1>
);
return (
<div>
{element}
</div>
);
}
}
...