一、什么是react #

二、react的特点 #

React的核心是组件,组件的设计目的是提升代码的复用率、降低测试难度和代码复杂度。

三、react的开发环境的配置 #

如果是要直接在HTML上编辑,需要下载react.jsreact-dom.js。如果要使用JSX语法,则需要使用转换JSX语法的插件。这里使用brower.js。在线地址:https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js

注意:三者引用顺序必须是reactreact-dombrower

四、React、ReactDOM中有什么 #

image.png

image.png

五、yeoman环境 #

yeoman前端脚手架工具

cnpm i -g yeoman

https://github.com/react-webpack-generators/generator-react-webpack#readme

# Make sure both is installed globally
npm install -g yo
npm install -g generator-react-webpack

# Create a new directory, and `cd` into it:
mkdir my-new-project && cd my-new-project

# Run the generator
yo react-webpack
# Start for development
npm start # or
npm run serve

# Start the dev-server with the dist version
npm run serve:dist

# Just build the dist version and copy static files
npm run dist

# Run unit tests
npm test

# Auto-run unit tests on file changes
npm run test:watch

# Lint all files in src (also automatically done AFTER tests are run)
npm run lint

# Clean up the dist directory
npm run clean

# Just copy the static assets
npm run copy

六、React脚手架搭建 #

npm i create-react-app

create-react-app your-app-name && cd your-app-name

npm install 

npm start