react router 使用出现报错

2017-11-01 00:40:49 +08:00
 hao0607
Uncaught TypeError: Cannot read property 'func' of undefined
at Object../node_modules/_react-router@2.8.1@react-router/lib/InternalPropTypes.js (InternalPropTypes.js:9)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at fn (bootstrap 7fbd0ef …:87)
at Object../node_modules/_react-router@2.8.1@react-router/lib/PropTypes.js (PropTypes.js:12)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at fn (bootstrap 7fbd0ef …:87)
at Object../node_modules/_react-router@2.8.1@react-router/lib/index.js (index.js:15)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at fn (bootstrap 7fbd0ef …:87)
at Object../src/App.js (App.css?8811:26)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at fn (bootstrap 7fbd0ef …:87)
at Object../src/index.js (index.css?06e0:26)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at fn (bootstrap 7fbd0ef …:87)
at Object.0 (myTab.js:69)
at __webpack_require__ (bootstrap 7fbd0ef …:669)
at bootstrap 7fbd0ef …:715
at bundle.js:719


上面是我使用 react 路由出现的报错 大神们 知道什么原因吗?本人 react 小白一枚,刚学习 react
4088 次点击
所在节点    问与答
3 条回复
vardarling
2017-11-01 01:21:52 +08:00
从 prop-types 引入 PropTypes
xiaonizi
2017-11-01 09:19:09 +08:00
前两天同事也出现过这个问题,检查一下 react 版本
Rico
2017-11-03 18:44:29 +08:00
我也遇到了这个问题。react16 的不能兼容 react-router 2/3 如果要用 react-router2/3,需将 react 降级到 15

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/402442

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX