import React from 'react';
import ReactDOM from 'react-dom';function Childcom() {let title = < h2 > 我是副标题 < /h2>let weather = "下雨"let isGo = weather == '下雨' ? "不出门" : "出门"return ( <div ><h1 > 函数式组件 helloworld < /h1> { title } <div >是否出门? <span > { isGo } < /span> < /div ></div >)
}
class HelloWorld extends React.Component {render() {return ( <div ><h1 >类组件定义HELLOWORLD </h1></div >)}
}ReactDOM.render( <HelloWorld / > ,document.querySelector('#root')
)
运行结果