- 我是 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/