警告:propType失败:在`Pane`中未指定必需的prop`childm。检查`first-time-tab`的render方法

时间:2016-11-13 18:35:21

标签: javascript jquery html reactjs redux

  • 我是js的新手。
  • 我有一个标签代码可以正常工作。
  • 我尝试将我的代码集成到代码库中,但是我收到了警告......提供代码和警告。
  • 你们可以告诉我如何解决它。

    render:function(){         回来(

          < 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 个答案:

答案 0 :(得分: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>);
      }
    });

但仍尝试传递内容。在渲染方法或Pane类中将道具从children更改为content