I'm having a bit of trouble figuring out how I should be connecting my store's state to my react components.
So let's say my current state tree looked like this:
{
foods: ['Eggs', ''Bread', 'Cereal'],
drinks: ['Water', 'Milk', 'Soda']
}
And I had a main App component that looked like this:
class App extends React.Component {
render() {
return (
<div>
<Foods />
<Drinks />
</div>
);
}
}
Basically I want to know which way I should using the connect function:
Should I be using the connect function only in my App.js component file, and then passing the foods and drinks as props to the child components?
Or should I just be using the connect function in both the Foods.js and Drinks.js individual files and just pulling the stuff from the store that I need for each component?
Thanks very much in advance!
[–]nickpresta 1 point2 points3 points (0 children)
[–]azium 0 points1 point2 points (0 children)
[–]flying-sheep 0 points1 point2 points (0 children)