Installation installation of React.js tutorial

Source: Internet
Author: User

Installation installation of React.js tutorial
  1. Run method

     Run react there are three ways 1. If you are only learning react, you can Http://codepen.io/gaearon/pen/rrpgnb?editors=0010 write code only 2://facebook.github.io/react/ downloads/single-file-example.html can download this HTML file, write the code directly, the compilation speed is very slow 3-react-app command-line tools, or add them directly to the project you are developing   
  2. Create a new app app

    这是开发react单页面应用最好的方式,提供了完善的开发环境,你可以使用最新的js特性,拥有非常好的开发体验,并且生产环境的代码优化了,使用如下命令运行react应用npm install create-react-app -gcreate-react-app my-appcd my-appnpm start创建的程序不会处理后端的逻辑和数据库,仅仅是创建了一个前端的构建通道,所以你可以使用任何的后端语言。在此程序的背后使用了诸如Babel和webpack的构建工具,尽管这些工具有很复杂的配置,但是react保证让你零配置运行项目,当你写好了项目,可以使用npm run build创建优化后的代码,这些代码将放在build文件夹中,关于create-react-app命令行工具的更多介绍,请访问https://github.com/facebookincubator/create-react-app#create-react-app- 和 https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#table-of-contents
  3. Add react to a project that already exists

    Adding react does not need to rewrite the project, we recommend that you add react to a small part of your project, as a standalone part, to see if react is working properly, react can be used alone without the need to build the pipeline, but we recommend that you set this feature, Because it will be your development more efficient, a modern build pipeline includes the following aspects1Package Manager, such as yarn or NPM, facilitates the management of third-party packages2. Packers, such as Webpack or browserify, can help you write modular code and package it into smaller packages to save download time3The compiler, such as Babel, can help you write modern JS code that can be used in the old browser as follows:1. Install react NPM init npm Install--save react react-dom2. Install Babel and Jsx Babel to include Babel-preset-react or Babel-preset-es20153Installation of Webpack simple react ProgramImport ReactFrom' React ';Import Reactdomfrom  ' react-dom '  reactdom. render (<h1>Hello ,world! </h1>,  Document.getelementbyid ( ' root ' )  )  4. Specify the react version used for production and development   
  4. Some of the above is not mentioned, this involves the knowledge behind, and then the

Installation installation of React.js tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.