0
我有一些困难,理解如何添加文档路由与反应路由器4下面的设置中。也许uuid需要作为通道传递给DocumentsPage,以便您可以返回DocumentPage ?反应路由器4与参数嵌套路由
routes = {
home: '/',
documents: '/documents',
createDocument: '/documents/create',
document: '/document/:uuid',
}
<BrowserRouter>
<div>
<Switch>
<Route exact={true} path={routes.home} component={HomePage} />
<Route path={routes.documents} component={DocumentsPage} />
<Route path={routes.createDocument} component={CreateDocumentPage} />
<Route component={NotFoundPage} />
</Switch>
</div>
</BrowserRouter>
欢迎来到Stack Overflow。在你的路由声明中,没有一个用于/ document(单数) - 是这个问题吗? – Mikkel
没有。添加它没有效果。看起来像createDocument也指向文档。嗯... –
因此,createDocument路由将无法访问,因为您尚未指定'确切'。 – Mikkel