hao0607
V2EX  ›  问与答

react router 使用出现报错

  •  
  •   hao0607 · Nov 1, 2017 · 4584 views
    This topic created in 3141 days ago, the information mentioned may be changed or developed.
    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 replies    2017-11-03 18:44:29 +08:00
    vardarling
        1
    vardarling  
       Nov 1, 2017
    从 prop-types 引入 PropTypes
    xiaonizi
        2
    xiaonizi  
       Nov 1, 2017
    前两天同事也出现过这个问题,检查一下 react 版本
    Rico
        3
    Rico  
       Nov 3, 2017
    我也遇到了这个问题。react16 的不能兼容 react-router 2/3 如果要用 react-router2/3,需将 react 降级到 15
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   838 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 20:20 · PVG 04:20 · LAX 13:20 · JFK 16:20
    ♥ Do have faith in what you're doing.