react-router问题

来源:10-1 Router概念

arongteqier

2017-09-07

bundle.js:360 Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function`.

    in Route (created by Root)

    in Root

printWarning @ bundle.js:360

warning @ bundle.js:384

checkReactTypeSpec @ bundle.js:28875

validatePropTypes @ bundle.js:10993

createElement @ bundle.js:11047

render @ bundle.js:12282

(anonymous) @ bundle.js:19995

measureLifeCyclePerf @ bundle.js:19275

_renderValidatedComponentWithoutOwnerOrContext @ bundle.js:19994

_renderValidatedComponent @ bundle.js:20021

performInitialMount @ bundle.js:19561

mountComponent @ bundle.js:19457

mountComponent @ bundle.js:2823

performInitialMount @ bundle.js:19570

mountComponent @ bundle.js:19457

mountComponent @ bundle.js:2823

mountComponentIntoNode @ bundle.js:9239

perform @ bundle.js:4648

batchedMountComponentIntoNode @ bundle.js:9261

perform @ bundle.js:4648

batchedUpdates @ bundle.js:23214

batchedUpdates @ bundle.js:1413

_renderNewRootComponent @ bundle.js:9454

_renderSubtreeIntoContainer @ bundle.js:9536

render @ bundle.js:9557

(anonymous) @ bundle.js:12294

__webpack_require__ @ bundle.js:20

module.exports @ bundle.js:66

(anonymous) @ bundle.js:69

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

    in Router (created by Root)

    in Root

printWarning @ bundle.js:360

warning @ bundle.js:384

checkReactTypeSpec @ bundle.js:28875

validatePropTypes @ bundle.js:10993

createElement @ bundle.js:11047

render @ bundle.js:12279

(anonymous) @ bundle.js:19995

measureLifeCyclePerf @ bundle.js:19275

_renderValidatedComponentWithoutOwnerOrContext @ bundle.js:19994

_renderValidatedComponent @ bundle.js:20021

performInitialMount @ bundle.js:19561

mountComponent @ bundle.js:19457

mountComponent @ bundle.js:2823

performInitialMount @ bundle.js:19570

mountComponent @ bundle.js:19457

mountComponent @ bundle.js:2823

mountComponentIntoNode @ bundle.js:9239

perform @ bundle.js:4648

batchedMountComponentIntoNode @ bundle.js:9261

perform @ bundle.js:4648

batchedUpdates @ bundle.js:23214

batchedUpdates @ bundle.js:1413

_renderNewRootComponent @ bundle.js:9454

_renderSubtreeIntoContainer @ bundle.js:9536

render @ bundle.js:9557

(anonymous) @ bundle.js:12294

__webpack_require__ @ bundle.js:20

module.exports @ bundle.js:66

(anonymous) @ bundle.js:69

bundle.js:7034 Uncaught TypeError: Cannot read property 'location' of undefined

    at new Router (bundle.js:7034)

    at bundle.js:19494

    at measureLifeCyclePerf (bundle.js:19275)

    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (bundle.js:19493)

    at ReactCompositeComponentWrapper._constructComponent (bundle.js:19479)

    at ReactCompositeComponentWrapper.mountComponent (bundle.js:19387)

    at Object.mountComponent (bundle.js:2823)

    at ReactCompositeComponentWrapper.performInitialMount (bundle.js:19570)

    at ReactCompositeComponentWrapper.mountComponent (bundle.js:19457)

    at Object.mountComponent (bundle.js:2823)

老师 这是什么原因

写回答

1回答

Parry

2017-09-07

如果你安装了最新版本还请看一下第二十章。

0
1
arongteqier
我安装的react-router版本跟您的是一样的
2017-09-11
共1条回复

结合基础与实战学习React.js 独立开发新闻头条平台

轻松入门 React 开发,React Router 4 与 Webpack 2 完美升级项目

2768 学习 · 2126 问题

查看课程