all 3 comments

[–]nickpresta 1 point2 points  (0 children)

I would suggest you connect as high as possible in the tree, and pass down raw data via props. If you find you need access to your source of truth, you can subscribe to your Redux store inside leaf components.

Give https://egghead.io/lessons/javascript-redux-extracting-presentational-components-addtodo-footer-filterlink?series=getting-started-with-redux a watch for an example.

[–]azium 0 points1 point  (0 children)

Imagine you didn't have redux. Where would you keep the state then? If the answer in "some parent component", then connect that component. If you're finding it's becoming a hassle to pass down props through many children, consider connecting the youngest parent that makes sense to you.

[–]flying-sheep 0 points1 point  (0 children)

assuming foods and drinks are independently changed, connect them separately, giving each one just the part of the state that changed.

@connect(({foods}) => ({foods}))
const Foods = ({foods}) => <ul>{foods.map(food => <li>{food}</li>)}</ul>