2017-12-28 34 views
2

내 프로젝트에 react-highcharts을 사용하고 있습니다. 차트 구성 요소를 동적으로 생성하고 사용자의 선택에 따라 번호를 변경하려고합니다.왜 렌더링 중에 실수가 나옵니까?

Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it. 

어떤 이유가 될 수 있습니다 내가 실수를 얻을 렌더링하는 동안

export default class ContentChartItem extends Component { 

    constructor(props) { 
     super(props); 
     this.state = { 
     } 

     this.config = {} 

    render() { 
     let { process_data } = this.props; 
     let config = this.config; 

     return (
      <div className="column"> 
       {typeof process_data == "undefined" ? " " 
        : 
        <div className="ui segment"> 
         {this.getChartItemsList} 
         <div className="ui button tiny fluid sidenav4"> 
          Info 
         </div> 
        </div> 
       } 
      </div> 
     ) 
    } 

    getChartItemsList =() => { 
     let config = this.config; 
     let { process_data } = this.props; 
     let chartContainers = []; 
     for (let i=0; i<process_data.length; i++) { 
      chartContainers.push(<ReactHighcharts config = {config}> </ReactHighcharts>) 
     } 

     return chartContainers; 
    }; 


} 

: 나는 데이터를 얻고 highcharts 구성 요소의 배열을 만들고이를 반환 구성 요소와 기능을 썼다? 어떻게 해결할 수 있을까요? 여기에`) (`당신은 잊었 때문에

{ 
    process_data && (
    <div className="ui segment"> 
    {this.getChartItemsList()} 
    <div className="ui button tiny fluid sidenav4"> 
     Info 
    </div> 
    </div> 
)} 
+4

:이 구문으로 조건을 할 수있는 방법으로

{typeof process_data == "undefined" ? " " : <div className="ui segment"> {this.getChartItemsList()} <div className="ui button tiny fluid sidenav4"> Info </div> </div> } 

:'{this.getChartItemsList을 ( –

답변

1

당신은 this.getChartItemsList()를 호출하는 것을 잊었다)}`, 그 메서드를 호출하고 ques를 닫도록 투표 한 : 'Simple Typo'.