<div className="app">
<Router>
<Link
to="/dashboard"
style={{ width: "25rem", marginLeft: "50px", marginTop: "50px" }}>
Passing Props
</Link>
<Link
to="/"
style={{ width: "25rem", marginLeft: "50px", marginTop: "50px" }}>
Home
</Link>
<Link
to="/signin"
style={{ width: "25rem", marginLeft: "50px", marginTop: "50px" }}>
signin
</Link>
<Link
to="/signup"
style={{ width: "25rem", marginLeft: "50px", marginTop: "50px" }}
>
signup
</Link>
<Switch>
<Route
path="/dashboard"
component={() => <AWSConnection topic={this.state.topic} />}
/>
<Route path="/" />
<Route path="/signup" component={SignInForm}/>
<Route path="/signin" component={SignUpForm}/>
</Switch>
</Router>
</div>
只有主页和仪表板正在工作,其他两个没有显示任何内容
我的进口是
import {BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom'
当我单击主页时,它会回到主页,当我单击仪表板时,它会转到仪表板,但是当我单击登录或注册时,什么也没有发生。我看到 url 更改为 /signin 和 /singup 但没有显示任何内容。我使用登录和登录的虚拟组件进行了测试,仍然相同,它无法加载虚拟组件