小编Joe*_*hle的帖子

React Router失败道具'历史',未定义

我一直在关注Tyler Mcginnis的教程,并对反应路由器,尤其是历史记录表示不满.我最后逐字复制他的代码只是为了看看它是否只有我,但我还是得到了

Warning: React.createElement: type is invalid -- expected a string (for built-
in components) or a class/function (for composite components) but got:
undefined. You likely forgot to export your component from the file it's 
defined in.

Warning: Failed prop type: The prop `history` is marked as required in 
`Router`, but its value is `undefined`. in Router

Uncaught TypeError: Cannot read property 'location' of undefined
at new Router (index_bundle.js:8347)
at index_bundle.js:19079
at measureLifeCyclePerf (index_bundle.js:18859)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (index_bundle.js:19078)
at ReactCompositeComponentWrapper._constructComponent (index_bundle.js:19064) …
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

14
推荐指数
1
解决办法
2万
查看次数

标签 统计

react-router ×1

reactjs ×1