2016-11-13 1 views
0
  • 저는 js를 처음 사용합니다.
  • 잘 작동하는 탭 코드가 있습니다.
  • 내 코드를 코드베이스에 통합하려고 시도했지만 경고를받는 중입니다 ... 코드와 경고를 모두 제공해야합니다.
  • 너희들이 그걸 고치는 법을 말해 줄 수 있겠 니?경고 : 실패한 propType : 필요한 'prop` 자식이'창 '에 지정되지 않았습니다. `처음 탭 '의 렌더링 방법을 확인하십시오.

    렌더링 : 함수() { "바이올린을 작동하지"에서 리턴 (

     < Pane label = "Account Setup" 
         subtitle = "Days 1 and 2" 
         liClass = "sports-setup-ico first-time-active ft-active-tab" 
         content = { 
         this.state.panes[0] 
         } > 
    
         < /Pane> 
    
         < Pane label = "Investments Purchase" 
         subtitle = "Approx. Day 3" 
         liClass = "sports-invest-ico" 
         content = { 
         this.state.panes[1] 
         } > 
    
         < /Pane> 
    
         < Pane label = "Balance and Portfolio" 
         subtitle = "Approx. Day 4" 
         liClass = "sports-balance-ico" 
         content = { 
         this.state.panes[2] 
         } > 
    
         < /Pane> 
    
         < Pane label = "IPerformance" 
         subtitle = "Approx. Day 5" 
         liClass = "sports-perf-ico" 
         content = { 
         this.state.panes[3] 
         } > 
    
         < /Pane> < /Tabs> 
        ); 
        } 
    }); 
    

답변

1

을 당신은 : 아직

var Pane = React.createClass({ 
     displayName: 'Pane', 
     propTypes: { 
     label: React.PropTypes.string.isRequired, 
     children: React.PropTypes.element.isRequired 
     }, 
     render: function() { 
     return (<div> { 
      this.props.children 
     } < /div>); 
     } 
    }); 

그리고을 여전히 대신에 내용을 전달하려고 변경합니다. render 메소드 또는 Pane 클래스에서 children에서 content으로 이동하십시오.

+0

예 ... 어떻게 찾았습니까 –

+0

오류 메시지에서 : 실패한 propType : ** 필요한 prop' 어린이'는 '창'에 지정되지 않았습니다 **. render (..)를 확인합니다. 그래서 Pane 클래스에 필요한 소품이 있는지 확인한 후, 올바르게 전달되었는지 확인했습니다. 그것은 전혀 전달되지 않았습니다. 대신에 당신은 콘텐츠 창작자 인 Pane 클래스의 소품 인 내용물 prop를 전달하고있었습니다. 간단한 믹스 :) –

관련 문제