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 - -<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