警告:失败的道具类型:在“窗格”中未指定所需的道具“子项”.检查“首次时间选项卡”的呈现方法

Warning: Failed propType: Required prop `children` was not specified in `Pane`. Check the render method of `first-time-tab`

本文关键字:选项 时间 方法 检查 未指定 类型 失败 窗格 警告 子项      更新时间:2023-09-26
  • 我是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>
        );
      }
    });
    

在"不工作小提琴"中,你有:

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