Maintain consistency
When a parent component contains children, sometimes it is passed as an object and sometimes it is passed as an array.
Example:
<Parent> <Child></Child> </Parent>
In the above example, typeof Parent.children will be object whereas
<Parent> <Child></Child> <Child></Child> </Parent>
typeof Parent.children will be Array.
The current behavior
Single child is treated as object and List of child is treated as array.
The expected behavior
Single child and list to be treated as an array of children.
Example
https://codesandbox.io/s/mystifying-antonelli-j4qe3
Maintain consistency
When a parent component contains children, sometimes it is passed as an object and sometimes it is passed as an array.
Example:
<Parent> <Child></Child> </Parent>In the above example, typeof Parent.children will be object whereas
<Parent> <Child></Child> <Child></Child> </Parent>typeof Parent.children will be Array.
The current behavior
Single child is treated as object and List of child is treated as array.
The expected behavior
Single child and list to be treated as an array of children.
Example
https://codesandbox.io/s/mystifying-antonelli-j4qe3