[当我尝试重新加载子页面应用程序时,将我重定向到主页。当我输入浏览器子页面(例如:/about
)时,应用会将我重定向到主页。这是我在App.js中的路由器组件。
P.S,我在React中使用箭头功能。
<Router>
<Header />
<Container history={props.history}>
<Route exact path="/" component={SelectLogin} />
<Route path="/selectlogin" component={SelectLogin} />
<Route path="/about" component={About} />
<Route path="/register" component={RegisterPanel} />
<Route path="/addcomment" component={AddComment} />
<Route path="/findposts" component={FindPosts} />
<Route path="/lostposts" component={LostPosts} />
<Route path="/posts" component={Posts} />
<Route path="/lostpost" component={LostPost} />
<Route path="/findrequest" component={FindRequest} />
<Route path="/lostrequest" component={LostRequest} />
<Route path="/requestsummary" component={Summary} />
<Route path="/logincode" component={LoginCodePanel} />
<Route path="/logindata" component={LoginDataPanel} />
<Route path="/adminpanel" component={AdminPanel} />
<Route path="/editprofile" component={EditProfile} />
<Route path="/userpanel" component={UserPanel} />
<Route path="/userposts/:id" component={UserPosts} />
<Route path="/editpost" component={EditPost} />
</Container>
</Router>
[当我尝试重新加载子页面应用程序时,将我重定向到主页。当我在浏览器子页面(例如:/ about)中键入应用程序时,会将我重定向到主页。这是我在App.js中的路由器组件。 P.S我在...
我相信您错过了中间的<Switch />
组件。