【发布时间】:2016-09-22 16:06:04
【问题描述】:
我正在使用 React Router v4 和 BrowserRouter。
这里的截图显示 BrowserRouter 的 props 有一个action="POP"。
但是,当我的路线如上图所示匹配时,RegisterMatch 或 MatchProvider 不会通过 props 接收操作、历史记录等。
我通过https://github.com/ReactTraining/react-router/blob/v4/website/components/FakeBrowser/index.js#L96 看到可能需要注入这些道具,但我无法理解或使其发挥作用。
【问题讨论】:
-
看来我想要的是一个尚未发布的 ControlledRouter (github.com/ReactTraining/react-router/issues/3879) 同时,我会试试这个:gist.github.com/steida/16da36887e6e6b466e12ba3a4ae6ce87
标签: react-router