首页 > 解决方案 > 为什么我无法从 react-router 获取参数?

问题描述

https://github.com/Vladislav747/Electron_With_React

尝试从此处的参数获取 id - https://github.com/Vladislav747/Electron_With_React/blob/master/src/components/Editing/index.js 第 17 行 - 但未定义 - 哪里出错了???

标签: reactjsreact-router

解决方案


除非您不初始化构造函数,否则您将无法访问 this.props。请参阅:https ://stackoverflow.com/a/53022470/12855221 。


推荐阅读