I found the solution I wanted and it works, see below.....
I know I am doing something stupid but I am having a mental block this morning and would appreciate some help. I am trying to construct html from a mapping:
In my render:
< ul>
{ arryItems.map(this.foo.bind(this)) }
< /ul>
Calling function:
foo(arry, i) {
let result = '';
if (arry.children != undefined && arry.children.length > 0) {
result= (
<div key= {i}>{arry.name}
{arry.children.map(function(child, ix){
<p key= {ix}>{child.name}</p>
})}
</div>
)
} else {
result = (<div>{arry.name}</div>)
}
return result;
};
I am trying to return back html.
While I am receiving no error, the < p>{child.name}< /p> is not in the return html result.
Can anyone point out what is so blatantly obvious with my thinking that I cannot figure this out?
ideclared twice - one for youfoofunction, and another for your children map function.