Hello World React

安装脚手架工具

npm install create-react-app -g

创建一个新的工程

create-react-app 工程名称

到工程文件夹中,运行该工程

npm start

 

我们建一个welcome.js

import React from 'react'

class Welcome extends React.Component{
    render(){
        return <h1>Hello React</h1>
    }
}

//导出整个类
export default Welcome;

在index.js中引入welcome即可

posted @ 2021-05-25 11:26  进击的米豆  阅读(45)  评论(0)    收藏  举报