V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
hao0607
V2EX  ›  问与答

react router 使用出现报错

  •  
  •   hao0607 · 2017-11-01 00:40:49 +08:00 · 4084 次点击
    这是一个创建于 2368 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Uncaught TypeError: Cannot read property 'func' of undefined
    at Object../node_modules/[email protected]@react-router/lib/InternalPropTypes.js (InternalPropTypes.js:9)
    at __webpack_require__ (bootstrap 7fbd0ef …:669)
    at fn (bootstrap 7fbd0ef …:87)
    at Object../node_modules/[email protected]@react-router/lib/PropTypes.js (PropTypes.js:12)
    at __webpack_require__ (bootstrap 7fbd0ef …:669)
    at fn (bootstrap 7fbd0ef …:87)
    at Object../node_modules/[email protected]@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
    3 条回复    2017-11-03 18:44:29 +08:00
    vardarling
        1
    vardarling  
       2017-11-01 01:21:52 +08:00
    从 prop-types 引入 PropTypes
    xiaonizi
        2
    xiaonizi  
       2017-11-01 09:19:09 +08:00
    前两天同事也出现过这个问题,检查一下 react 版本
    Rico
        3
    Rico  
       2017-11-03 18:44:29 +08:00
    我也遇到了这个问题。react16 的不能兼容 react-router 2/3 如果要用 react-router2/3,需将 react 降级到 15
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5455 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 07:41 · PVG 15:41 · LAX 00:41 · JFK 03:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.