Reputation: 2780
What is the difference (if any) in the way React handles 'props.children' versus if I were simply to add the same JSX in as a prop? Is this just simply for better presentation of code?
<Parent>
<Child />
<Child />
</Parent>
vs.
<Parent otherChildren={<><Child /><Child /></>} />
Upvotes: 1
Views: 131
Reputation: 15821
The main difference is that props.children can be declared both in props and enclosed in JSX tag of the component. Beside that, the behavior is exactly the same.
Upvotes: 1