Open wohuifude123 opened 6 years ago
Hey bro, I was getting the same error and I found that:
Version 4 of React Router changed things around a bit. They made separate top level router elements for the different history types. If you're using version 4 you should be able to replace
I hope that it works to you too! :)
Version
"react-dom": "^15.6.1", "react-router": "^4.2.0", "react-router-dom": "^4.2.2"
Steps to reproduce
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 inRouter
, but its value isundefined
. 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)