Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Latest commit

 

History

History
25 lines (19 loc) · 533 Bytes

children_component_type.md

File metadata and controls

25 lines (19 loc) · 533 Bytes

props/childrenComponentType

Returns a function used in propTypes to validate that children are of a specific component type.

function childrenComponentType(component: React.Component): function

Args

component:React.Component
The expected component

Returns

A function which React will use to validate the component children.

Examples

class MyComponent extends React.Component {
  static propTypes = {
    children: childrenComponentType(MyOtherComponent)
  }
}