react 第一个组件 “hello world!”
程序员文章站
2022-06-24 15:27:23
一:在src下面新建Welcome.js 二:在Welcome.js中使用类式写法: 三:在index.js中插入Welcome.js 四:cnpm start 运行项目 ......
一:在src下面新建welcome.js
二:在welcome.js中使用类式写法:
import react from "react"
class welcome extends react.component{
render(){
return <h1>hello world!</h1>
}
}
export default welcome
三:在index.js中插入welcome.js
四:cnpm start 运行项目