React/Redux - RecipeBox Project - Container/Component

React/Redux - RecipeBox Project - Container/Component
0.0 0


Hi there,

I don’t know when to use a Container or Component.
Is it better to have less Containers or isn’t there any rule?

The structer of my app:


In my example I have the problem that I have a RecipeList Container wich displays Recipes. I made the RecipeList to a Container to access the state to get all recipes.
Know I don’t know if I can make the Recipe Component to a Container too. The Recipe Component could handle my RecipeBody to toggle the visibility like in the example project of FCC, but there for I need access to the store to dispatch the toggleAction.
The RecipeList COntainer could handle this toggle function too, but than I have to pass this function as props to the Recip Container

I hope you understand my problem …


There is no hard-and-fast rule for this, and I’m not sure how much help you can get if we can’t see the code. Never forget the cardinal rule of programming:

Get it working

This isn’t going to be a massive project. Once it’s working, you’ll better see what should change, and then can make those changes fairly easily.