2016-06-22 2 views
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); 

사람이 말해 줄래?

+0

은 '<경로 경로 = "/ 게시물보기"구성 요소 = {가상보기} />와 같은 경로 경로에 허용되는 공백입니다. " – Vikramaditya

+0

예. 허용됩니다. –

+1

[경고 : 실패한 propType : \ Route \]에 잘못된 prop \'구성 요소 \가 제공됨] (http://stackoverflow.com/questions/33950433/warning-failed-proptype-invalid-prop-component- 제공 - 경로) – James111

답변

1

App, PContainer 및 PView가 모두 유효한 React 구성 요소인지 확인하십시오. 모듈의 가져 오기 및 내보내기를 확인하십시오. 내보내기는 "default"로해야합니다. 그렇지 않으면 named import : import {somecomp} from './somecomp'을 사용해야합니다. 구성 요소 경로를 확인하십시오.

경로가 약간 이상해 보입니다. : './container/PContainer/PContainer' 및입니다. 당신이 PContainerPVIEW 폴더가없는 경우

은 아마, './container/PContainer''./container/PView'해야한다.