I am making a recipe box app. Here is the code pen. http://codepen.io/capozzic1/pen/gmpVyr?editors=0110. Here is the code:
class RecipeList extends React.Component {
constructor(props) {
super(props);
}
render() {
var recipes = this.props.recipes;
var recLi = recipes.map(recipe => recipe.ingredients.map(ingred => <li>{ingred}</li>));
var recNames = recipes.map(recipe => <h2>{recipe.title}</h2>);
return (
<div className="recList">
<ul className="recUl">
{recNames}
{recLi}
</ul>
</div>
);
}
}
Ideally, I want to have each recipe name and its accompanying ingredients. Right now, it shows stacked. Is there a way I can use map to have recNames and recLi merged into one div together for each recipe?