hao0607
V2EX  ›  问与答

react router 使用出现报错

  •  
  •   hao0607 · Nov 1, 2017 · 4871 views
    This topic created in 3313 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
    vardarling
    Nov 1, 2017
    1
    从 prop-types 引入 PropTypes
    xiaonizi
    xiaonizi
    Nov 1, 2017
    2
    前两天同事也出现过这个问题,检查一下 react 版本
    Rico
    Rico
    Nov 3, 2017
    3
    我也遇到了这个问题。react16 的不能兼容 react-router 2/3 如果要用 react-router2/3,需将 react 降级到 15
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 19:40 · PVG 03:40 · LAX 11:40 · JFK 14:40
    ♥ Do have faith in what you're doing.