创建项目
执行命令
npx create-react-app frontendcd frontendnpm start
简化项目
src/index.js
import React from 'react';import ReactDOM from 'react-dom';import App from './App';ReactDOM.render(<App />,document.getElementById('root'));
src/app.js
function App() {return (<div>App</div>);}export default App;
public/index.html
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"><title>blog-v1</title></head><body><div id="root"></div></body></html>
项目目录
src|-components 公共组件|-pages 页面内容组件|-request 网络请求|-constants 常量|-store|--|-reducers|--|-store|-app.js 根组件|-index.js 入口文件
