Establish react scaffolding - white entry

I. Introduction: React internal project originated in Facebook, because the company's all JavaScript MVC framework on the market, are not satisfied, he decided to write a set for the erection Instagram website.

After do it, find this stuff useful, in May 2013 open source.

Two, React scaffolding: create-react-app

React to build an environment, it is more complicated, there are a lot of dependence: react, react-dom, babel, webpack ... requires a lot of pre-knowledge, it is tempting to give up from entry.

Thus was born  脚手架 this kind of thing, create-react-app is a React scaffolding that makes it really easy to create a whole React to build an environment that addresses all the dependency issues.

The more upper construction, more convenient tool also shows us to customize the worse for the ground floor. But for the novice to learn the students to do first thing after the application up, it is necessary to go to understand what the underlying environment, is kind of a good learning path.

Third, the establishment scaffolding:

(1) Computer must first install the latest version of Node.js     https://www.runoob.com/nodejs/nodejs-install-setup.html

        It will include direct live: npm npm is a what? https://blog.csdn.net/qq_37696120/article/details/80507178

(2) installed a Node.js configuration after the environment variable, and then you can use npm download the create-react-app:  

  Use Taobao NPM mirror

       We all know that domestic direct use of official mirror npm is very slow, it is recommended to use Taobao NPM mirror.

       Taobao is a complete npmjs.org NPM mirror image, you can use this instead of the official version (read-only), synchronous frequency of the current 10 minutes to ensure as far as possible be synchronized with the official service.

       You can use Taobao custom cnpm (gzip compression support) command-line tool instead of the default npm:

   $ Asl install - g cnpm - registry = https : //registry.npm.taobao.org

       So that you can use cnpm command to install the module:

  $ cnpm install [name]
  接着:
cnpm isntall -g create-react-app 就是下载这个了脚手架了

  create-react-app my-app  创建一个名为my-app的项目(可以先进入cd想部署的文件夹,然后创建这个项目,否则默认c盘)

慢慢等待安装

安装好了之后,接下来进入这个目录 cd my-app
然后安装依赖(脚手架都差不多) npm install
启动项目:npm start

项目跑起来的话,就用默认用你的3000端口打开构建的本地服务器,如果你的3000端口被占用,就会用其他端口打开啦


 项目查看 可以用 webstorm或者vsCode打开,然后编写,运行。

参考博客:
https://www.runoob.com/nodejs/nodejs-npm.html
https://www.jianshu.com/p/e16a9da931ec

 
 
 

Guess you like

Origin www.cnblogs.com/1starfish/p/11695693.html