Given a component receives a function as a child (callback as a child pattern, also known as render prop pattern):
<Foo>{() => <Bar/>}</Foo>
React.Children.count(props.children) === 0
in Foo
.
The documentation doesn't seem to mention that React.Children
accepts only valid React elements, so the fact that child function is ignored looks odd.
How does React.Children
treat non-element children and why?
References to official sources and/or source code are welcome.
from React.Children with non-element children
0 komentar:
Posting Komentar