WhenyourebuildingyourReactcomponents, response. Parentcanreaditschildrenbyaccessingthespecialthis. props. childrenprop. this. props. childrenisanopaquedatastructure: use
When you're building your React components, you'll probably want to access child properties of the markup. parent can read its children by accessing the special this. props. children prop. this. props. children is an opaque data structure: use
When you're building your React components, you'll probably want to access child properties of the markup.
ParentCan read its children by accessing the specialthis.props.childrenProp.this.props.childrenIs an opaque data structure:Use the React. Children utilities to manipulate them.
Https://facebook.github.io/react/docs/multiple-components.html
This. props. children undefined
You can't access the children of your component throughthis.props.children.this.props.childrenDesignates the children beingPassed onto youBy the owner.
Https://facebook.github.io/react/tips/children-undefined.html
Type of the Children props
Usually, a component's children (this.props.children) Is an array of components. However, when there is only a single child,this.props.childrenWill be the single child component itselfWithout the array wrapper. This saves an array allocation.
Https://facebook.github.io/react/tips/children-props-type.html
React Lesson 6: Accessing Child Properties