我創建了一些組件。對於路由,我使用react-router-dom
。我的設置如下。通過反應路由器路由不工作
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Dashboard from './components/Dashboard.jsx';
import Login from './components/Login.jsx';
import Signup from './components/Signup.jsx';
import Application from './components/Application.jsx';
import "./assets/main.css"
ReactDOM.render(
<Router>
<Application>
<Switch>
<Route exact path="/" component={Dashboard} />
<Route path="login" component={Login} />
<Route path="/signup" component={Signup} />
</Switch>
</Application>
</Router>, document.getElementById('container')
);
在這裏,我唯一的 '/' 路線的工作,對於/login
和/signup
我Cannot GET /signup
。
請幫我出來。預計感謝
請分享控制檯 –
@NaveedAheer控制檯中的錯誤是乾淨的,只有'不能得到/屏幕 – Harish