acdlite / acdlite/redux-router
Failed prop type: The prop history is marked as required in Router, but its value is undefined
- 主要语言
- JavaScript
- 星标
- 2.3k
- 派生
- 194
- PR 合并指标
- 30 天内没有已合并 PR
描述
## Version
"react-dom": "^15.6.1",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2"
## Steps to reproduce
```
import React from 'react'
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom'
const BasicExample = () => (
- Home
- About
- Topics
)
const Home = () => (
Home
)
const About = () => (
About
)
const Topics = ({ match }) => (
Topics
-
Rendering with React
-
Components
-
Props v. State
(
Please select a topic.
)}/>
)
const Topic = ({ match }) => (
{match.params.topicId}
)
export default BasicExample
```
## Expected Behavior
It should work
## Actual Behavior
It doesn't work
warning.js:35 Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`.
in Router (created by RouterApp)
in RouterApp
printWarning @ warning.js:35
warning @ warning.js:59
checkReactTypeSpec @ checkReactTypeSpec.js:80
validatePropTypes @ ReactElementValidator.js:162
createElement @ ReactElementValidator.js:216
render @ router02.js:14
(anonymous) @ ReactCompositeComponent.js:795
measureLifeCyclePerf @ ReactCompositeComponent.js:75
_renderValidatedComponentWithoutOwnerOrContext @ ReactCompositeComponent.js:794
_renderValidatedComponent @ ReactCompositeComponent.js:821
performInitialMount @ ReactCompositeComponent.js:361
mountComponent @ ReactCompositeComponent.js:257
mountComponent @ ReactReconciler.js:45
performInitialMount @ ReactCompositeComponent.js:370
mountComponent @ ReactCompositeComponent.js:257
mountComponent @ ReactReconciler.js:45
mountComponentIntoNode @ ReactMount.js:104
perform @ Transaction.js:143
batchedMountComponentIntoNode @ ReactMount.js:126
perform @ Transaction.js:143
batchedUpdates @ ReactDefaultBatchingStrategy.js:62
batchedUpdates @ ReactUpdates.js:97
_renderNewRootComponent @ ReactMount.js:319
_renderSubtreeIntoContainer @ ReactMount.js:401
render @ ReactMount.js:422
(anonymous) @ main.js:73
__webpack_require__ @ bootstrap 669b1c396b5c27223987:1334
fn @ bootstrap 669b1c396b5c27223987:741
(anonymous) @ main.bundle.js:23047
__webpack_require__ @ bootstrap 669b1c396b5c27223987:1334
module.exports @ bootstrap 669b1c396b5c27223987:1383
(anonymous) @ bootstrap 669b1c396b5c27223987:1383
Router.js:31 Uncaught TypeError: Cannot read property 'location' of undefined
at new Router (Router.js:31)
at ReactCompositeComponent.js:294
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:293)
at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:279)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:187)
at Object.mountComponent (ReactReconciler.js:45)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:370)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:257)
at Object.mountComponent (ReactReconciler.js:45)
贡献指南
这个仓库没有索引到贡献指南
调研方向
The issue is about a prop validation error in Router where 'history' is undefined. Look at the Router component in the source code, likely in a file like Router.js. Check how the history prop is passed and validated. The error suggests a mismatch between react-router and react-router-dom versions or usage. Start by examining the example code and comparing it with the library's expected API. Verify the imports and the Router implementation in the project's examples or tests.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 40/100