react4.0以后的路由配置和之前的配置还是有很大区别的。
npm i 不指定版本去下载一般都是最新的,
在App.jsx直接引入配置就行
import React, { Component } from 'react'
import relationChart from './components/RelationChart';
import relationChart1 from './components/RelationChart1';
import './App.less'
import 'antd/dist/antd.css'
import { HashRouter, Route,Redirect } from 'react-router-dom'
export default class App extends Component {
constructor(props) {
super(props)
}
render () {
return (
<HashRouter>
<Route path='/' exact render={() => <Redirect to="/chart" />}></Route>
<Route path="/chart" component={relationChart} />
<Route path="/chart1" component={relationChart1} />
</HashRouter>
)
}
}