媒介
写此系列博客的目标是对所学React知识点的总结和梳理,包含填坑计划分享,希望能协助到还并不会运用React的开发者入门React
项目搭建
根据官方供应的create-react-app
搭建项目
全局装置
create-react-app
cnpm i create-react-app -g
或
cnpm i yarn -g
yarn global add create-react-app
全局装置后能够运用
create-react-app
这条敕令建立名为
react-demo
的项目create-react-app react-demo
启动项目
cd react-demo
npm start
或
yarn start
假如node 6+ 而且 npm 5.2+,能够运用npx装置
npx create-react-app react-demo
或
yarn create react-app react-demo
(yarn 0.25+)
cd react-demo
npm start
目次构造
public/index.html
页面进口文件,
src/App.js
根组件,
src/App.css
根组件款式文件,
src/index.js
顺序进口文件,
src/index.css
页面款式文件,
App.test.js
和
serviceWorker.js
临时不会运用,能够删除
运转项目
yarn start
项目运转胜利
下篇文章
React组件