list页面无法访问
来源:10-1 Router概念
慕无忌0079048
2017-12-11
版本为: "react-router": "^4.2.0", "react-router-dom": "^4.2.2"
router.js文件为:
import React from 'react';
import ReactDom from 'react-dom';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Index from './index';
import ComList from './components/list';
export default class Root extends React.Component {
render() {
console.log(Switch);
return (
<BrowserRouter >
<Switch>
<Route exact component={Index} path='/'></Route>
<Route component={ComList} path='/list'></Route>
</Switch>
</BrowserRouter>
);
}
}
ReactDom.render(
<Root />,
document.getElementById('example')
);
写回答
1回答
-
外部包裹怎么写的?
更新课程的源码在这里 https://github.com/ParryQiu/IMOOC-React/blob/master/react-router-4_webpack-2/src/js/root.js
052018-07-11
相似问题