javascript - 警告 : Failed propType: Required prop `children` was not specified in `Pane` . 检查 `first-time-tab` 的渲染方法

标签 javascript jquery html reactjs redux

  • 我是 js 新手。
  • 我有一个可以正常工作的选项卡代码。
  • 我尝试将我的代码集成到代码库中,但收到警告...同时提供代码和警告。
  • 你们能告诉我如何解决这个问题吗?

    渲染:函数() { 返回(

          < 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>
        );
      }
    });
    

最佳答案

在“不工作 fiddle ”中,您有:

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 类中将 prop 从 children 更改为 content

关于javascript - 警告 : Failed propType: Required prop `children` was not specified in `Pane` . 检查 `first-time-tab` 的渲染方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40577363/

相关文章:

javascript - setInterval导致内存溢出?

javascript - 将mapbox-style转换为openlayers 3 vectorTile样式

JavaScript 正则表达式帮助 : Match 0 or 1 times but do not capture

jquery - 在 jquery 画廊中切换缩略图和大图像?

html - Markdown 到 HTML

javascript - HTML5 网络音频 - 减慢音频播放提前中断

javascript - ng-show 在 ng-repeated 列表中

javascript - parseInt() 导致 javascript 函数的返回值是预期结果的 0.77 倍,基数指定为十进制

javascript - Div 对 fadeIn jQuery 感到不安

html - 网页布局在不同屏幕上显示不同