According to edit documents , if a component has several children, this.props.children should be an array.
I have the following component:
export class Two extends React.Component { componentDidMount() { console.log(Array.isArray(this.props.children));
What I pass to children in another component render () method:
<Two> <Img src="/photos/tomato.jpg"/> <Img src="/photos/tomato.jpg"/> </Two>
Why is this.props.children not an array? More importantly, how can I make him be alone?
source share