react-router中getUserConfirmation是在哪里实现的呢?
在看react-router源码的时候,看到了Prompt的实现方法。
然后想起来Prompt可以自定义行为,然后在react-router-dom包里搜了一下getUserConfirmation
props。但是我没有找到相关的实现代码
只是在md文档里写了默认使用window.comfirm()。问下各位大神 关于getUserConfirmation
的具体实现在哪里呀?
react-router version: 5.2.0
react-router-dom version: 5.2.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BrowserRouter 只是简单返回了 Router 组件,那么
this.props
里的getUserConfirmation
只能是给createHistory
处理了。 react-router 依赖的 history 版本是 4.9.0 而非最新的 5.0.0 代码。找到 history 中的createBrowserHistory
方法:https://github.com/ReactTrain...搜索到对
getUserConfirmation
的使用:https://github.com/ReactTrain...再深入
createTransitionManager
代码https://github.com/ReactTrain...