I would like to have a condition that claims that prop is a React node, and then just fits as a child in the component, and if not, take some action to turn it into a component. Thus, my component will be able to accept this support as an array of strings or an array of nodes.
I tried to check if React.PropTypes.node is React.PropTypes.node boolean, and it is not.
Let's say I have a module called List and there is a stand called items . I would like to go through
var items = [ "One", "Two", "Three" ]
and
var items = function () { return ( <li>One</li> <li>Two</li> <li>Three</li> ) }
And inside the component there is some logic that would detect the difference, and if a simple array (and not an array of nodes) could display elements.
javascript properties reactjs
Thomas reggi
source share