0
爲什麼只工作根路徑,當我到達本地主機:8090 /關於它 說的。無法獲得本地主機:8090 /約React路由器只適用於/路徑
import React,{Component} from "react"
import {BrowserRouter as Router,Route} from "react-router-dom"
var About =()=>{
return <div>About us{}</div>
}
class App extends Component{
render(){
return (
<Router>
<div>
<Route path ="/" component={About}/>
<Route path ='/about'component={About}/>
</div>
</Router>
);
}
}
export default App;
main.js入口點(的WebPack)
import React from "react"
import ReactDOM from "react-dom"
import App from "./components/App.jsx"
ReactDOM.render(
<App />,
document.getElementById('table')
);
我'使用 「反應路由器-DOM」: 「^ 4.0.0-beta.7」
非常有用)th'x –