vue2.0 添加了render函数和类似react的JSX
vue2.0
new
Vue({
// components:{App} //vue1.0写法
render
:(
h)
=>
h(
App)
//vue2.0写法
}).
$mount(
'#app')
render
:
(
h
)
=>
h
(
App
)解析如下
1.
render
:
function (
createElement){
return
createElement(
App)
}
2. render (
createElement){
return
createElement(
App)
}
3. render (
h){
return
h(
App)
}
react
const
element = (
<
h1
>
Hello
</
h1
>
);
ReactDOM.
render(
element,
document.
getElementById(
'root')
);