需要声明包含字符串和参数的可选路径
现在我有了这个路径
<Route exact path="/tasks/:id" render={(props) => (
<AsyncTask {...props} profile={this.state.profile} />
)} />
Run Code Online (Sandbox Code Playgroud)
我需要
/tasks/:id/notification/:notificationId
Run Code Online (Sandbox Code Playgroud)
在哪里notification/:notificationId
可选
我尝试以这种方式添加它,但它不起作用
/tasks/:id/(notification/:notificationId)?
Run Code Online (Sandbox Code Playgroud)
我需要知道我是否来自通知链接,将其标记为已读.
这很有效
/tasks/:id/(notification)?/:notificationId?
Run Code Online (Sandbox Code Playgroud)
但它没有匹配和路径 notificationId