React 入门

 

官网:https://react.docschina.org/docs/getting-started.html

入门资料:https://www.taniarascia.com/getting-started-with-react/

教程:https://www.runoob.com/react/react-tutorial.html

入门· Create React App 中文文档

create-react-app入门教程

 


mkdir myreact

cd myreact

npx create-react-app react-tutorial


安装成功后提示:

Success! Created react-tutorial at C:\Users\Administrator\Desktop\front-end\react\react-tutorial
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd react-tutorial
  npm start

Happy hacking!

 

为了打包项目,部署于nginx,我们需要首先修改-package.json

在package.json里面添加一行
"homepage": ".",

在项目文件夹下,
npm run build
自动建立一个build文件夹
把build拷贝到nginx,访问index.html即可
# 启动 sass
cd my-app
npm install node-sass --save

# 安装完之后,可以直接把原来的CSS文件后缀直接改为 .scss 或者.sass,然后组件中导入的文件不再是 css文件而给我scss文件即可。
# 配置代理

npm install http-proxy-middleware --save

# 直接在package.json文件中添加proxy节点即可:
{
  ...
  "proxy": "http://localhost:4000",
  ...
}
# 安装 react-mapbox-gl mapbox-gl

npm install react-mapbox-gl mapbox-gl --save

react-mapbox-gl 参考

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值