反应路由器错误
React Router Errors
我没完没了。我的反应路线有问题......现在,我正在加载我的相册的显示页面(AlbumPage)和索引页面(AlbumPane)......一个人需要做什么才能使路线正常工作?
const App = () => (
<div>
<AuthRoute exact path="/" component={OfflineHeaderContainer} />
<AuthRoute exact path="/signup" component={OfflineHeaderContainer} />
<AuthRoute exact path="/login" component={OfflineHeaderContainer} />
<AuthRoute path="/" component={Splash} />
<Route exact path="/home" component={Index}/>
<Switch>
<ProtectedRoute exact path="/photos/create" component={Create} />
<Route path="/photos/:photoID" component={Show} />
<Route exact path="/albums/:albumID" component={AlbumPage} />
</Switch>
<Route path="/albums" componen={AlbumPane} />
<Route exact path="/users/:userID" component={UserProfileContainer} />
</div>
);
看起来你有一些错别字,改一下:
<Route path="/albums" componen={AlbumPane} />
为此:
<Route exact path="/albums" component={AlbumPane} />
然后你将只加载你想要的路由时有条件地请求 albumID
我没完没了。我的反应路线有问题......现在,我正在加载我的相册的显示页面(AlbumPage)和索引页面(AlbumPane)......一个人需要做什么才能使路线正常工作?
const App = () => (
<div>
<AuthRoute exact path="/" component={OfflineHeaderContainer} />
<AuthRoute exact path="/signup" component={OfflineHeaderContainer} />
<AuthRoute exact path="/login" component={OfflineHeaderContainer} />
<AuthRoute path="/" component={Splash} />
<Route exact path="/home" component={Index}/>
<Switch>
<ProtectedRoute exact path="/photos/create" component={Create} />
<Route path="/photos/:photoID" component={Show} />
<Route exact path="/albums/:albumID" component={AlbumPage} />
</Switch>
<Route path="/albums" componen={AlbumPane} />
<Route exact path="/users/:userID" component={UserProfileContainer} />
</div>
);
看起来你有一些错别字,改一下:
<Route path="/albums" componen={AlbumPane} />
为此:
<Route exact path="/albums" component={AlbumPane} />
然后你将只加载你想要的路由时有条件地请求 albumID