Created
September 4, 2016 04:38
-
-
Save t3h2mas/e280afd35b9c2ee64576fa9d56db2132 to your computer and use it in GitHub Desktop.
Remove Recipe callback concern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Recipe from './Recipe'; | |
const RecipeBox = (props) => { | |
const removeRecipe = props.removeRecipe; // scope to `.map` | |
let recipeNodes = props.recipes.map((recipe) => { | |
return <Recipe | |
name={recipe.name} | |
ingredients={recipe.ingredients} | |
id={recipe.id} | |
key={recipe.id} | |
removeRecipe={removeRecipe} | |
/> | |
}); | |
return ( | |
<div className="recipe-box"> | |
{recipeNodes} | |
</div> | |
) | |
}; | |
RecipeBox.propTypes = { | |
recipes: React.PropTypes.array.isRequired | |
}; | |
export default RecipeBox; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment