You are confusing Array.forEach with forEach does not return anything. The correct way is:

    {, index) => 
        <ChildComponent key={index} childName={} />

map converts the given element into another element, a component in this case. The result of calling map is an array of components that is then rendered. forEach always returns undefined therefore the result of your code is the same as writing:


Note that key is also necessary when rendering lists of components.

Related Query

More Query from same tag