2
當我運行我的瀏覽器的應用程序,我得到我的控制檯上:提供了無效的道具‘組件’:警告:無法propType:無效的道具「組件」供給「路線」
「警告:無法propType到 '路線'」
我的路線文件:
import { Route, IndexRoute } from 'react-router';
import React from 'react';
import App from './container/App';
import PContainer from './container/PContainer/PContainer';
import PView from './container/PView/PView';
const routes = (
<Route path="/" component={App} >
<IndexRoute component={PContainer} />
<Route path="/Posts View" component={PView} />
</Route>
);
export default routes;
我PVie w文件:
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
class PView extends Component {
render() {
return (
<div>
<h1>List of Posts</h1>
</div>
);
}
}
export default connect()(PView);
有誰能告訴我爲什麼我得到這個錯誤?
是在路由路徑中允許的空間,如' '? –
Vikramaditya
是的,它被允許。 –
[Warning:失敗的propType:無效的prop \'component \'提供給\'Route \']可能重複(http://stackoverflow.com/questions/33950433/warning-failed-proptype-invalid-prop-component-提供給路由) – James111