I am working on the Recipe Box challenge and I need some help figuring out how to get a child component to talk to a parent, specifically editing props passed to a child, and having those changes saved to a parent.
here is my structure.
<RecipeContainer> <RecipeList> <-- Recipes stored here as a list. (stored in state) <Recipe> <RecipeView></RecipeView> <!-- A recipe can be edited here. (passed by prop) </Recipe> <Recipe> <RecipeView></RecipeView> </Recipe> <Recipe> <RecipeView></RecipeView> </Recipe> </RecipeList> </RecipeContainer>
holds a list of recipes and the component is generated accordingly, and one recipe is passed as a prop.
is like a modal window, here the user has a change to edit the recipe text.
The problem is that a child cannot edit a prop and have it propagate via a parent.
Here is some of the code I am working on: http://codepen.io/Jon1701/pen/BzJqjR