"Learning" Reactjs (i)--use NPM to create react projects and integrate Elementui

Source: Internet
Author: User
Tags button type

In the course of the internship to understand the react, so intends to use react to build a page of their own, if there are questions to ask, thank you.

Github:https://github.com/yclxt/react-elementui

Tools:

Use tool: Nodejs;jetbrains webstorm

Nodejs installation and configuration environment variables are not written here.

To create a process:

Command line installation Global Create-react-app Scaffolding tool: NPM install-g Create-react-app

Navigate to the working directory and create the project: Create-react-app React-elementui

Special note: The project name cannot have uppercase characters.

Go to project directory: Perform NPM start

In this way, the React project is created.

Next, install the Elementui component.

Perform the NPM i element-react--save to install, then NPM install Element-theme-default--save installs the necessary theme packs.

Finally, it is used! I modified app.js by adding a button that did not add any events to the code as follows:

1Import React, {Component} from ' React ';2Import logo from './logo.svg ';3Import './app.css ';4 5Import {Button} from ' Element-react ';6Import ' Element-theme-default ';7 8 class App extends Component {9 render () {Ten     return ( One<div classname= "APP" > A - -&LT;H1 classname= "App-title" >welcome to React the -<p classname= "App-intro" > -Hello REACT!!! -</p> +<button type= "PRIMARY" >Hello</Button> -</div> +     ); A   } at } -  -ExportdefaultAPP;

In this way, the creation of the work is all done.

File Analysis:

Project structure:

Where Node_moudles is where the project relies on packages (similar to the library in Java)

SRC is the main area of project development

Build is where the file is stored after compilation

Package.json is used to record project information, as well as import information for external dependency packages, etc.

Ref: 79743832

Https://elemefe.github.io/element-react/#/zh-CN/quick-start

"Learning" Reactjs (i)--use NPM to create react projects and integrate Elementui

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.