react中路由的安装及使用 安装react-router-dom npm install react-router-dom --save-dev 在index.js中引入router import {HashRouter, Route, Switch} from “react-router-dom”; 使用router <HashRouter> <Switch> <Route path="/" component={Home}></Route> </Switch> </HashRouter>