ReactJs: What should the PropTypes be for this.props.children?

前端 未结 8 1107
梦如初夏
梦如初夏 2020-12-04 05:49

Given a simple component that renders its children:

class ContainerComponent extends Component {
  static propTypes = {
    children: PropTypes.object.isRequ         


        
8条回答
  •  -上瘾入骨i
    2020-12-04 06:45

    If you want to include render prop components:

      children: PropTypes.oneOfType([
        PropTypes.arrayOf(PropTypes.node),
        PropTypes.node,
        PropTypes.func
      ])
    

提交回复
热议问题